ZOJ-The 14th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple-A~B
来源:互联网 发布:用户画像常用算法 编辑:程序博客网 时间:2024/06/06 03:52
ACM模版
心血来潮,参加了这么啥比赛,名字好长啊,只是参加了网赛,感觉还行,就是看不懂题~~~前两题过于简单,所以写在一起吧!
A-Cooking Competition
描述
题解
水题。
代码
#include <iostream>using namespace std;const int K[] = {0, 1, 0, 1, -1};const int D[] = {0, 0, 1, 1, -1};int main(int argc, const char * argv[]){ int T; cin >> T; int n, x, resK, resD; while (T--) { cin >> n; resK = resD = 0; for (int i = 0; i < n; i++) { cin >> x; resK += K[x]; resD += D[x]; } if (resK > resD) { cout << "Kobayashi\n"; } else if (resK < resD) { cout << "Tohru\n"; } else { cout << "Draw\n"; } } return 0;}
B-Problem Preparation
描述
题解
这个题有一个暗坑,明明说难度最低为1,数据范围还
代码
#include <iostream>#include <algorithm>#include <cstdio>using namespace std;const int MAXN = 110;int s[MAXN];int main(int argc, const char * argv[]){// freopen("/Users/zyj/Desktop/input.txt", "r", stdin); int T; scanf("%d", &T); int n; while (T--) { scanf("%d", &n);// int cnt = 0; for (int i = 0; i < n; i++) { scanf("%d", s + i);// if (s[i] == 1)// {// cnt++;// } } if (n < 10 || n > 13/* || cnt < 2*/) { printf("No\n"); continue; } sort(s, s + n); // ??? if (s[0] != 1 || s[0] != 1) { printf("No\n"); continue; } int flag = 1; for (int i = 1; i < n; i++) { if (s[i] - s[i - 1] > 2 && s[i] != s[n - 1]) { flag = 0; break; } } if (flag) { printf("Yes\n"); } else { printf("No\n"); } } return 0;}
0 0
- ZOJ-The 14th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple-A~B
- The 14th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple(A+B+C+D)
- ZOJ-The 14th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple-E
- ZOJ-The 14th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple-C
- ZOJ-The 14th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple-D
- The 14th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple C题What Kind of Fri
- The 12th Zhejiang Provincial Collegiate Programming Contest - A
- The 14th Zhejiang Provincial Collegiate Programming Contest (待续)
- The 17th Zhejiang University Programming Contest Sponsored by TuSimple 浙大校赛C题 How Many Nines
- ZOJ 146 - The 13th Zhejiang Provincial Collegiate Programming Contest - C Defuse the Bomb
- The 7th Zhejiang Provincial Collegiate Programming Contest
- The 6th Zhejiang Provincial Collegiate Programming Contest
- The 8th Zhejiang Provincial Collegiate Programming Contest / L - Javabeans
- The 8th Zhejiang Provincial Collegiate Programming Contest / M - Median
- The 8th Zhejiang Provincial Collegiate Programming Contest
- The 9th Zhejiang Provincial Collegiate Programming Contest
- The 5th Zhejiang Provincial Collegiate Programming Contest 部分题解
- The 10th Zhejiang Provincial Collegiate Programming Contest Solution
- 判断是不是PE文杰
- ftp详解
- 【自考学习】计算机网络——协议
- 本地调试HTML和CSS的方法
- Android 高性能编码二:利用缓存提高TPS
- ZOJ-The 14th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple-A~B
- Codeforces Round #410 (Div. 2) D. Mike and distribution 思维
- Spacemacs 使用
- jquery笔记-api
- Hibernate 中MappingException:Unknown entity的问题解决方案
- Linux后台执行脚本
- SparkSQL On Yarn with Hive,操作和访问Hive表
- tomcat中有wtpwebapps和webapp
- 骁龙视觉深度学习SDK