HDU
来源:互联网 发布:双十一每年数据 编辑:程序博客网 时间:2024/05/17 22:41
#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <string>#include <cmath>#include <set>#include <map>#include <stack>#include <queue>#include <ctype.h>#include <vector>#include <algorithm>#include <sstream>#define PI acos(-1.0)#define in freopen("in.txt", "r", stdin)#define out freopen("out.txt", "w", stdout)using namespace std;const int maxn = 100000 + 7;int T, n;string c;string s[10][30];set<string> st, st2;void init() { st.clear(); //st2.clear(); scanf("%d", &n); cin >> c; for(int i = 0; i < 6; ++i) { for(int j = 0; j < 20; ++j) { cin >> s[i][j]; } } //cout << n << " + " << c << endl;}void solve() { int cnt = 0, f = 0; for(int j = 0; j < 20; ++j) { for(int i = 0; i < 5; ++i) { if(s[i][j] == c) { f = 1; break;} else { if(st.count(s[i][j]) == 0) { st.insert(s[i][j]); cnt++; } } if(cnt >= n) break; } if(f || cnt >= n) break; } //cout << cnt << endl; if(cnt >= n) { cout << 0 << endl; return; } int t = n - cnt; int cnt2 = 0; f = 0; for(int i = 5; i < 6; ++i) { for(int j = 0; j < 20; ++j) { if(s[i][j] == c) { f = 1; break;} else { if(st.count(s[i][j]) == 0) { st.insert(s[i][j]); cnt2++; } } if(cnt2 >= t) break; } if(f || cnt2 >= t) break; } if(cnt2 >= t) cout << t << endl; else cout << "ADVANCED!" << endl;}int main() { scanf("%d", &T); int kase = 1; while(T--) { init(); printf("Case #%d: ", kase++); solve(); } return 0;}
阅读全文
1 0
- hdu
- hdu
- HDU
- hdu ()
- hdu
- hdu
- HDU
- HDU
- hdu
- hdu
- HDU
- Hdu
- hdu
- hdu-
- hdu
- hdu
- hdu
- HDU
- Presto单机/集群模式安装笔记
- 列表和元组
- The Moving Points HDU
- ArrayList vs. LinkedList vs. Vector
- 课程笔记之六:神经网络的代价函数和误差反向传播算法
- HDU
- 组装台式机流程
- ngui ui的坐标是相对父物体的中心点的坐标
- 05 java里的多态
- 可以重写静态方法吗?
- HDU 1423 && ZOJ 2432 (LCIS模板)
- 隐藏MainActivity自带的标题栏
- HashMap和Hashtable的区别
- HashMap和HashSet的区别