codeforces round #394 (div. 2) A\B 题解
开始啦~
始まった
T1
#include <stdio.h>
int l,r,even,odd;
void Jud(){
for(int i=1;i<=200;i++){
for(int j=i;j<=200;j++){
odd=even=0;
for(int k=i;k<=j;k++)
k&1?odd++:even++;
if(even==l&&odd==r){
puts("YES");
return;
}
}
}
puts("NO");
}
int main(){
scanf("%d%d",&l,&r);
Jud();
return 0;
}
T2
#include <math.h>
#include <stdio.h>
#include <memory.h>
int n,L,a[55],b[55],ta[105],tb[105];
bool Jud(){
for(int l=0;l<L;l++)
if(ta[l]!=tb[l])
return 0;
return 1;
}
void solve(){
for(int i=0;i<n;i++)
tb[b[i]]++;
for(int k=1;k<=L;k++){
memset(ta,0,sizeof ta);
for(int i=0;i<n;i++)
ta[(++a[i])%=L]++;
if(Jud()){
puts("YES");
return;
}
}
puts("NO");
}
int main(){
scanf("%d%d",&n,&L);
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
for(int i=0;i<n;i++)
scanf("%d",&b[i]);
solve();
return 0;
}
codeforces round #394 (div. 2) A\B 题解的更多相关文章
- Codeforces Round #394 (Div. 2) E. Dasha and Puzzle(分形)
E. Dasha and Puzzle time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Round #612 (Div. 2) 前四题题解
这场比赛的出题人挺有意思,全部magic成了青色. 还有题目中的图片特别有趣. 晚上没打,开virtual contest打的,就会前三道,我太菜了. 最后看着题解补了第四道. 比赛传送门 A. An ...
- Codeforces Round #198 (Div. 2)A,B题解
Codeforces Round #198 (Div. 2) 昨天看到奋斗群的群赛,好奇的去做了一下, 大概花了3个小时Ak,我大概可以退役了吧 那下面来稍微总结一下 A. The Wall Iahu ...
- Codeforces Round #672 (Div. 2) A - C1题解
[Codeforces Round #672 (Div. 2) A - C1 ] 题目链接# A. Cubes Sorting 思路: " If Wheatley needs more th ...
- Codeforces Round #394 (Div. 2) 题解
无需吟唱,直接传送 problem A 题目大意 已知有n个偶数,m个奇数,问这些数有没有可能组成一个严格递增1的序列 题解 判断abs(n,m) <= 1即可,注意n,m均为0的情况. Cod ...
- Codeforces Round #394 (Div. 2) 颓废记
昨天晚上(今天凌晨),又忍不住去打CF.(本蒟弱到只能打Div.2)... 我觉得我可以用一个词概括我这次的CF: 呵呵 刚一开赛,我就codeforces访问失败.. 后来好不容易能上了,两三分钟才 ...
- Codeforces Round #394 (Div. 2) E. Dasha and Puzzle 构造
E. Dasha and Puzzle 题目连接: http://codeforces.com/contest/761/problem/E Description Dasha decided to h ...
- Codeforces Round #394 (Div. 2) D. Dasha and Very Difficult Problem 贪心
D. Dasha and Very Difficult Problem 题目连接: http://codeforces.com/contest/761/problem/D Description Da ...
- Codeforces Round #394 (Div. 2) C. Dasha and Password 暴力
C. Dasha and Password 题目连接: http://codeforces.com/contest/761/problem/C Description After overcoming ...
随机推荐
- libpcap 中调用ctime()时警告提示:
warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=] ...
- recast 生成navmesh主要流程
参考: critterai http://www.critterai.org recast & Detour https://github.com/recastnavig ...
- centos 重装docker
docker应该是root用户来使用,因为他连接了底层!!!以下操作默认是root用户来操作的 停止所有正在运行的容器: docker stop $(docker ps -a -q) 删除所有的容器c ...
- deepin 安装maven
1.在官网 http://maven.apache.org/download.cgi 下载mvn包 2.新建mvn目录 mkdir /usr/local/mvn 把压缩包解压到mvn目录下面 修 ...
- mysql的子查询的提高
统计胜负结果的sql语句 date result 2011-02-01 胜 2011-02-01 负 2011-02-0 ...
- Glide和Picassio的比较
http://blog.csdn.net/fancylovejava/article/details/44747759 对象池: Glide原理的核心是为bitmap维护一个对象池.对象池的主要目的是 ...
- 【洛谷3345_BZOJ3924】[ZJOI2015]幻想乡战略游戏(点分树)
大概有整整一个月没更博客了 -- 4 月为省选爆肝了一个月,最后压线进 B 队,也算给 NOIP2018 翻车到 316 分压线省一这个折磨了五个月的 debuff 画上了一个不算太差的句号.结果省选 ...
- jquery中有关cookie的使用简要说明
jquery.cookie.js 的配置 首先包含jQuery的库文件,在后面包含 jquery.cookie.js 的库文件. <script type="text/javascri ...
- 引入css的四种方式
1.内联式引用:直接用在标签上,但维护成本高 style='font-size:16px;color:#000000' 2.外部连接式引用:css代码与html代码分离,便于代码重复使用 <li ...
- ubuntu查看系统资源占用(内存,cpu和进程)
http://blog.csdn.net/vivian187/article/details/51476043 http://bluexp29.blog.163.com/blog/static/338 ...