Codeforces Round #363 (Div. 2)
来源:互联网 发布:python socket 长度 编辑:程序博客网 时间:2024/06/06 05:05
代码:
#include<cstdio>#include<algorithm>using namespace std;char ch[200200];int shu[200200];int main(){ int n; scanf("%d",&n); scanf("%s",ch); for (int i=0;i<n;i++) scanf("%d",&shu[i]); int s=-1; for (int i=0;i<n-1;i++) if (ch[i]=='R'&&ch[i+1]=='L') { if (s==-1) s=(shu[i+1]-shu[i])/2; else s=min(s,(shu[i+1]-shu[i])/2); } printf("%d\n",s); return 0;}
代码:
#include<cstdio>#include<cstring>#include<algorithm>using namespace std;char ch[1020][1020];int hh[1020],ss[1020];int main(){ int n,m,s=0; scanf("%d%d",&n,&m); for (int i=1;i<=n;i++) { getchar(); for (int j=1;j<=m;j++) { scanf("%c",&ch[i][j]); if (ch[i][j]=='*') s++; } } for (int i=1;i<=n;i++) { int ss=0; for (int j=1;j<=m;j++) if (ch[i][j]=='*') ss++; hh[i]=ss; } for (int j=1;j<=m;j++) { int ks=0; for (int i=1;i<=n;i++) if (ch[i][j]=='*') ks++; ss[j]=ks; } int kp;int fafe=true; int x,y;x=0;y=0; for (int i=1;i<=n;i++) { for (int j=1;j<=m;j++) { kp=hh[i]+ss[j]; if (ch[i][j]=='*') kp--; if (kp==s) { fafe=false; x=i;y=j; break; } } if (!fafe) break; } if (fafe) printf("NO\n"); else { printf("YES\n"); printf("%d %d\n",x,y); } return 0;}close
代码:
#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int shu[120];int main(){ int n;scanf("%d",&n); for (int i=0;i<n;i++) scanf("%d",&shu[i]); int s=0,kp=0; for (int i=0;i<n;i++) { if (shu[i]==0) { kp=0; s++; } else if (shu[i]==1) { if (kp==0||kp==2) { kp=1; } else { kp=0; s++; } } else if (shu[i]==2) { if (kp==0||kp==1) { kp=2; } else { kp=0; s++; } } else { if (kp==1) kp=2; else if (kp==2) kp=1; } } printf("%d\n",s); return 0;}close
0 0
- Codeforces Round #363 (Div. 2)
- Codeforces Round #363 (Div. 2)
- Codeforces Round #363 (Div. 2)
- Codeforces Round #363 (Div. 2)
- Codeforces Round #363 (Div. 2)
- Codeforces Round #363 (Div. 2)
- Codeforces Round #363 (Div. 2)
- Codeforces Round #363 (Div. 2)
- Codeforces Round #363 (Div. 2)
- Codeforces Round #363 (Div. 2) C. Vacations
- Codeforces Round #363 (Div. 2) [C] Vacations
- Codeforces Round #363 (Div. 2) C. Vacations
- Codeforces Round #363 (Div. 2) 题解报告
- Codeforces Round #363 (Div. 2)-C--贪心
- Codeforces Round #363 (Div. 2)--B
- Codeforces Round #363 (Div. 2) 题解
- Codeforces Round #363 (Div. 2) B 暴力
- Codeforces Round #363 (Div. 2) C dp
- 设计模式之代理模式
- Unity和Android相互通信
- Zxing生成二维码经典解析
- 磁盘那点事+卸载ubuntu+安装ubuntu
- Android 使用Loader轻松实现仿微信图片加载
- Codeforces Round #363 (Div. 2)
- 浅析Android中的消息机制
- Luncher
- Collapsing ToolbarLayout
- 45. 上传文件
- 表格文件的调用
- PHP学习-DAY4-PHP基础4
- 安全机制
- Deep Learning(深度学习)学习笔记整理系列之(二)