ZOJ 3929 Deque and Balls
来源:互联网 发布:新日铁住金软件 地址 编辑:程序博客网 时间:2024/05/05 01:10
虽然比赛时过了,但是过得不容易。放在这里为了警醒我以后不要出现太多低级bug,它们会让你开始怀疑人生。。。
#include<bits/stdc++.h>#define ll long long#define mod 1000000007using namespace std;ll power[100005];ll r[100005];ll dp[100005];int main(){power[0]=1;for(int i=1;i<=100000;++i){power[i]=(power[i-1]*2)%mod;}int t;cin>>t;while(t--){memset(r,0,sizeof(r));memset(dp,0,sizeof(dp));int n,a;cin>>n;for(int i=1;i<=n;++i){cin>>a;dp[i]=(dp[i-1]*2+power[i-2]-r[a]+mod)%mod;if(i==1)r[a]=(r[a]+1)%mod;elser[a]=(r[a]+power[i-2])%mod;}cout<<dp[n]*2%mod<<endl;}return 0;}
0 0
- ZOJ 3929 Deque and Balls
- ZOj 3929Deque and Balls
- ZOJ 3929 Deque and Balls
- ZOJ 3929 Deque and Balls
- ZOJ 3932 Deque and Balls
- ZOJ-3929-Deque and Balls【思维】【好题】
- zoj 3929 Deque and Balls 树状数组 递推
- ZOJ 3929 Deque and Balls (放球问题_DP思维好题)
- ZJU/ZOJ Deque and Balls 3929 计数:小的情况对总情况的贡献。 小心mod运算陷阱
- 期望 zoj3929 Deque and Balls
- zoj3929 Deque and Balls 【找规律】
- Bear and Three Balls
- Bear and Three Balls
- Bear and Three Balls
- Balls and Boxes
- Bear and Three Balls
- Bear and Three Balls
- Bear and Three Balls
- bzoj2434: [Noi2011]阿狸的打字机
- 单层决策树
- 【C语言】链表 题
- 使用valgrind检查内存使用问题
- ng-click
- ZOJ 3929 Deque and Balls
- 【剑指offer系列】 数组中逆序对___36
- ng-select
- 《c++ primer》第六章 函数
- android 布局属性(alignBaseLine在最后有详细解释)
- C#基础之配置文件(FAQ)
- Python学习笔记-偏函数
- ng-submit
- 无锁编程:lock-free原理