cqm解题报告F
来源:互联网 发布:怎么设置淘宝会员名 编辑:程序博客网 时间:2024/05/18 21:11
http://acm.cqu.edu.cn/oj/problem_show.php?pid=21464
本题不是很难,仔细观察就可以得知x+n-i是恒定的(x是每个人的金钱,n是队列的长度,i是在当前位置。如果那么很显然的一点是如果出现相同的xi+n-i,那么一定是无限交换队列。
下面附上AC代码。
#include<iostream>#include<algorithm>#include<cstdio>#include<queue>#include<cstring>#include<cstring>using namespace std;const int maxn=2e6+10;bool vis[maxn];int main(){ int t; scanf("%d",&t); int ca=1; while(t--) { int n; scanf("%d",&n); bool flag=false; memset(vis,false,sizeof(vis)); for(int i=0;i<n;i++) { int a; scanf("%d",&a); int b=a+n-i; if(vis[b]) flag=true;//如果出现相同的 vis[b]=true; } if(flag) { printf("Case %d: No\n",ca++); }else{ printf("Case %d: Yes\n",ca++); } }}
0 0
- cqm解题报告F
- cqm解题报告02
- cqm解题报告I
- cqm解题报告03
- cqm 解题报告e
- F - Babelfish解题报告
- cqm解题报考01
- cqm题解报告04
- 7/21 F 解题报告
- 2017.4.17解题报告f
- F - Babelfish解题报告(黄杰)
- F - Dividing解题报告(来自网络)
- F - Summits解题报告(来自网络)
- F - Pipe Fitters解题报告(熊禾强)
- HDU 4734 F(x) 解题报告
- F - The Hardest Problem Ever解题报告
- F - The Suspects(解题报告)
- 山东省第二届ACM省赛 F题 Manhattan 解题报告
- neutron-server的启动流程(二)
- 在redhat6.4安装redis集群
- Nginx详细配置
- 十二章常用类
- SparkStreaming运行机制和架构详解
- cqm解题报告F
- Commit failed with error: did not match any file(s) known to git. 解决办法
- hdu 2795 Billboard(线段树)
- linux备份数据库
- pi ocr 及二维码识别
- 算法解剖系列-Canny边缘检测原理及实现
- HDU 3853 LOOPS 概率dp
- SICP ex1-30 ex1-31
- 如何判断text-overflow: ellipsis???