8VC Venture Cup 2016 - Elimination Round 总结
来源:互联网 发布:网络直销是什么 编辑:程序博客网 时间:2024/05/03 18:38
题意:
某机器人可以按上下左右移动。。。现给出一串指令,机器人所处空间无限大,问有多少该指令的某一连续子串,使得机器人执行后回原位
#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;const int maxm=1e3+10;char s[maxm];int main(){ int n; while(scanf("%d",&n)!=EOF) { scanf("%s",s); int sum=0; for(int i=0; i<strlen(s); i++) { for(int j=i+1; j<strlen(s); j++) { int x=0,y=0; for(int k1=i; k1<=j; k1++) { if(s[k1]=='U') { y++; } if(s[k1]=='R') { x++; } if(s[k1]=='L') { x--; } if(s[k1]=='D') { y--; } } if(x==0&&y==0) { sum++; } } } printf("%d\n",sum); } return 0;}
题意:
Catherine有n张卡片,每张卡片分别是蓝绿红的其中一种颜色每次可以执行两种操作中的一种:
1:将两张同色卡片换成一张该颜色卡
2:将两张异色卡片换成一张第三种颜色卡
问:最后剩的一张卡可能是什么颜色
所有情况都讨论一遍就好。。。
#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;const int maxm=1e3+10;char s[maxm];int main(){ int n; while(scanf("%d",&n)!=EOF) { scanf("%s",s); int b=0,r=0,g=0; for(int i=0;i<n;i++) { if(s[i]=='B') b++; else if(s[i]=='R') r++; else g++; } if(b&&g&&r) { printf("BGR\n"); continue; } if(!b&&!g) { printf("R\n"); continue; } if(!b&&!r) { printf("G\n"); continue; } if(!r&&!g) { printf("B\n"); continue; } if(!b) { if(g>1&&r>1) { printf("BGR\n"); continue; } else if(g==1&&r==1) { printf("B\n"); continue; } else if(g==1) { printf("BG\n"); continue; } else { printf("BR\n"); continue; } } if(!g) { if(b>1&&r>1) { printf("BGR\n"); continue; } else if(b==1&&r==1) { printf("G\n"); continue; } else if(b==1) { printf("BG\n"); continue; } else { printf("GR\n"); continue; } } if(!r) { if(g>1&&b>1) { printf("BGR\n"); continue; } else if(g==1&&b==1) { printf("R\n"); continue; } else if(g==1) { printf("GR\n"); continue; } else { printf("BR\n"); continue; } } } return 0;}
题意:
好多小孩在玩建塔游戏。。。其中一队只有高度为2的积木,另一队只有高度为3的积木,他们都不喜欢自己建的塔的高度和其他小孩一样,问满足条件情况下最高的塔的高度最低是多少
对于任意i,记
a1:小于等于i的所有数中是2的倍数但不是6的倍数的数
a2:小于等于i的所有数中是3的倍数但不是6的倍数的数
a3:小于等于i的所有数中是6的倍数的数
若a1+a2+a3 >= n+m 则i是解
#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;int main(){ int n,m; while(scanf("%d%d",&n,&m)!=EOF) { for(int i=1;;i++) { int a1=max(n-(i/2-i/6),0); int a2=max(m-(i/3-i/6),0); int a3=i/6; if(a1+a2<=a3) { printf("%d\n",i); break; } } } return 0;}
1 0
- 8VC Venture Cup 2016 - Elimination Round 总结
- 8VC Venture Cup 2016 - Elimination Round总结
- 8VC Venture Cup 2017 - Elimination Round
- 8VC Venture Cup 2016 - Elimination Round题解
- 8VC Venture Cup 2016 - Elimination Round A. Robot Sequence
- Codeforces 8VC Venture Cup 2016 - Elimination Round解题报告
- 8VC Venture Cup 2016 - Elimination Round C - Block Towers
- Codeforces 8VC Venture Cup 2016 - Elimination Round
- 8VC Venture Cup 2016 - Elimination Round C. Block Towers
- 8VC Venture Cup 2017 - Elimination Round(A+B)
- Codeforces 8VC Venture Cup 2017 - Elimination Round
- 解题报告:8VC Venture Cup 2016 — Elimination Round C.Block Towers
- 8VC Venture Cup 2016 - Elimination Round B. Cards (隐式图DFS)
- 8VC Venture Cup 2016 - Elimination Round C. Block Towers (二分)
- 8VC Venture Cup 2016 - Elimination Round E. Simple Skewness(枚举+三分)
- 8VC Venture Cup 2016 - Elimination Round F. Group Projects(DP)
- 8VC Venture Cup 2016 - Elimination Round-A. Robot Sequence(模拟)
- 8VC Venture Cup 2016 - Elimination Round-B. Cards(暴力)
- BZOJ 2956 模积和 公式推导
- CentOS 7 上安装 Docker 详解
- Machine Learning - Gradient Descent in Practice
- poj 3273 Monthly Expense
- 鼠标自动点击 python版
- 8VC Venture Cup 2016 - Elimination Round 总结
- S3C6410的clock设置
- 文件合并上传
- NSArray常用方法
- OpenStack云计算快速入门教程 OpenStack及其构成简介
- 06-mac截图
- 程序员必须得严谨啊...Access denied for user 'sa'@'localhost' (using password: YES)
- BZOJ 3238 AHOI 2013 差异 后缀数组 单调
- UI总结