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 ...
随机推荐
- 洛谷P1850 [noip2016]换教室——期望DP
题目:https://www.luogu.org/problemnew/show/P1850 注释掉了一堆愚蠢,自己还是太嫩了... 首先要注意选或不选是取 min 而不是 /2 ,因为这里的选或不选 ...
- hdu1814 Peaceful Commission——2-SAT
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1814 第一次的2-SAT,推荐博客:https://blog.csdn.net/jarjingx/arti ...
- uva1560
In an extended version of the game Lights Out®, is a puzzle with 5 rows of 6 buttons each (the actua ...
- hive 内部表与外部表的区别
hive 内部表: hive> create table soyo55(name STRING,addr STRING,money STRING) row format delimited fi ...
- render same axis
// 当前渲染相机的参数 QGlobalCamera* curRenderCamera = _getWorld()->getMainCam(); const Matrix4& ...
- bzoj 1647: [Usaco2007 Open]Fliptile 翻格子游戏【dfs】
这个可以用异或高斯消元,但是我不会呀我用的暴搜 2的m次方枚举第一行的翻转情况,然后后面的就定了,因为对于一个j位置,如果i-1的j位置需要翻,那么一定要翻i的j,因为这是i-1的j最后翻的机会 按字 ...
- shiro vue 前后端分离中模拟登录遇到的坑
系统采用jeeplus框架(ssm+redis+shiro+mongodb+redis),默认是了JSP未做前后端分离,由于业务需要已经多终端使用的需求(H5.小程序等),需要实现前后端分离.但是由于 ...
- redis的bitmap
BitMap是什么 就是通过一个bit位来表示某个元素对应的值或者状态,其中的key就是对应元素本身.我们知道8个bit可以组成一个Byte,所以bitmap本身会极大的节省储存空间. Redis中的 ...
- [Qt Creator 快速入门] 第8章 界面外观
一个完善的应用程序不仅应该有实用的功能,还要有一个漂亮的外观,这样才能使应用程序更加友好,更加吸引用户.作为一个跨平台的UI开发框架,Qt提供了强大而灵活的界面外观设计机制.这一章将学习在Qt中设计应 ...
- 线段树+树状数组+贪心 HDOJ 5338 ZZX and Permutations
题目传送门 /* 题意:不懂... 线段树+树状数组+贪心:贪心从第一位开始枚举,一个数可以是循环节的末尾或者在循环节中,循环节(循环节内部是后面的换到前面,最前面的换到最后面).线段树维护最大值,树 ...