HDU-6008-Worried School
来源:互联网 发布:照片白边框软件 编辑:程序博客网 时间:2024/06/05 02:42
ACM模版
描述
题解
简单的模拟题,题意不是特别容易翻译,但是模拟的规则十分简单,和
如果没有任何一种
代码
#include <cstdio>#include <cmath>#include <set>#include <iostream>using namespace std;const int MAXN = 6;const int MAXM = 21;const int MAXB = 100;int G;string S;string ECsite[MAXM];string RGsite[MAXN][MAXM];set<string> st;int main(){ int T; scanf("%d", &T); for (int ce = 1; ce <= T; ce++) { cin >> G >> S; for (int i = 1; i < MAXN; i++) { for (int j = 1; j < MAXM; j++) { cin >> RGsite[i][j]; } } for (int j = 1; j < MAXM; j++) { cin >> ECsite[j]; } int pos, cnt, y = -1; for (int x = 0; x <= G; x++) { st.clear(); bool staX = false, staY = false; if (x > 0) { for (int r = 1; r <= MAXB; r++) { pos = r % 5; if (pos == 0) { pos += 5; } cnt = (int)ceil(r / 5.0); if (RGsite[pos][cnt] == S) { staX = 1; } st.insert(RGsite[pos][cnt]); if (st.size() >= x) { break; } } } if (G - x > 0) { for (int j = 1; j < MAXM; j++) { if (ECsite[j] == S) { staY = 1; } st.insert(ECsite[j]); if (st.size() >= G) { break; } } } if (!staX && !staY) { y = G - x; } } printf("Case #%d: ", ce); if (y == -1) { printf("ADVANCED!\n"); } else { printf("%d\n", y); } } return 0;}
阅读全文
0 0
- HDU-6008-Worried School
- Worried School HDU-6008 模拟
- Worried School HDU
- HDU6008-Worried School
- Problem J. Worried School(日期模拟 STL)
- hdu 4207 Grade School Multiplication
- hdu 1445 Ride to School
- HDU 1445 - Ride to School
- hdu 1445 Ride to School
- school
- Korea worried
- HDU 1445 Ride to School 贪心
- HDU 4207 And SOJ 4198 Grade School Multiplication
- 文章标题 HDU 1445 : Ride to School (贪心)
- School Offer
- Back School
- school emulate
- sql school
- U盘插上,系统有反应,但是却不识别,电脑能识别其他的U盘,U盘在其他电脑也是好用的经验分享(驱动问题)
- HDU 4474
- 十:.pyc是个什么?
- 新秀杯热身赛-wq的矩阵
- 十一:数据类型初识
- HDU-6008-Worried School
- BootStrap模态框闪退
- github入门
- Eventbus 1.0-3.0
- 【面试】--big Data
- BaseWeb03-JSP
- 林中漫步,白书P330Uva10917(dijkstra求最短路,动态规划)
- RNN和LSTM原理推导
- kindEditor_upload的文件上传