ZOJ 3603 Draw Something Cheat【模拟】
来源:互联网 发布:医院感染控制软件 编辑:程序博客网 时间:2024/05/18 03:40
Have you played Draw Something? It's currently one of the hottest social drawing games on Apple iOS and Android Devices! In this game, you and your friend play in turn. You need to pick a word and draw a picture for this word. Then your friend will be asked what the word is, given the picture you have drawn. The following figure illustrates a typical scenario in guessing the word.
As you see, when guessing a word you will be given the picture and 12 letters. You must pick some of these letters to form a word that matches the picture. Each letter can only be used once. It is a lot of fun if your friend is a talented painter, but unfortunately some drawings from your friend are totally incomprehensible. After several times of becoming mad by the drawings, you find a way to cheat in the game.
In this game, letters not included in the correct answer are randomly generated. If you cannot find the correct answer when guessing, you can write down all the letters and restart the game. Then you would find some of these letters are changed. Of course these changed letters will never appear in the answer. By eliminating these letters you are a step closer to the answer.
So In this problem, you need to write a program to automate the cheating process. Given N strings of letters to the same picture, you need to eliminate as many letters as possible, and output the remaining letters.
Input
There are multiple test cases. The first line of the input is an integer T ≈ 1000 indicating the number of test cases.
Each test case begins with a positive integer N ≤ 20 indicating the number of times you have entered the game. Then N lines follow. Each line is a string of exactly 12 uppercase letters, indicating the candidate letters in one guess. It is guaranteed that the answer has at least 1 letter and has no more than 12 letters.
Output
For each test case, output the remaining letters in alphabet order after the process described above. One line for each test case.
Sample Input
22ABCDEFGHIJKLABCDEFGHIJKL2SAWBCVUXDTPNZQTLFJYRCGAK
Sample Output
ABCDEFGHIJKLACT
注意:例如good 出现了两次o
#include<cstdio>#include<math.h>#include<cstring>#include<climits>#include<string>#include<queue>#include<iostream>#include<cstdio>#include<cmath>#include<cstring>#include<climits>#include<string>#include<queue>#include<stack>#include<set>#include<map>#include<algorithm>using namespace std;#define rep(i,j,k)for(i=j;i<k;i++)#define per(i,j,k)for(i=j;i>k;i--)#define MS(x,y)memset(x,y,sizeof(x))#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1#define ll long long#define abs(x) (x>0?x:-x)const int INF=0x7ffffff;const ll MAX=1e18;const int M=1e2+10;char s[20];int flag[M];int le[M];int i,j,k,b,m,n;int main(){ int T;scanf("%d",&T);while(T--){ for(i=0;i<26;i++) flag[i]=INF;scanf("%d",&n);for(i=0;i<n;i++){ cin>>s; MS(le,0); for(j=0;j<12;j++){ le[s[j]-'A']++; } for(j=0;j<26;j++){ flag[j]=min( flag[j],le[j]); }} for(i=0;i<26;i++){ if(flag[i]!=INF) for(j=0;j<flag[i];j++) printf("%c",i+'A'); } printf("\n");}return 0;}
- zoj 3603 Draw Something Cheat(模拟)
- ZOJ 3603Draw Something Cheat(模拟)
- ZOJ 3603 Draw Something Cheat (模拟)
- ZOJ 3603 Draw Something Cheat【模拟】
- zoj 3603 Draw Something Cheat
- ZOJ 3603 Draw Something Cheat
- ZOJ 3603 Draw Something Cheat
- ZOJ 3603 Draw Something Cheat
- ZOJ 3603 Draw Something Cheat
- ZOJ 3603 Draw Something Cheat
- ZOJ 3603 Draw Something Cheat
- ZOJ 3603 Draw Something Cheat
- ZOJ 3603 Draw Something Cheat
- zoj 3603 Draw Something Cheat
- ZOJ Problem Set - 3603||Draw Something Cheat
- ZOJ-3603-Draw Something Cheat【字符串】【9th浙江省赛】
- ZOJ 3603 Draw Something Cheat (字符串,小陷阱)
- ZOJ3603-Draw Something Cheat
- tools:context="...Activity的作用
- iOS备忘录之自定义代码块
- Hibernate 一对多连接表双向关联
- QT中的TS文件与QM文件
- leecode 解题总结:37 Sudoku Solver
- ZOJ 3603 Draw Something Cheat【模拟】
- Spring 3 MVC深入研究
- 常用的git命令
- Android 热修复 Tinker接入及源码浅析
- Hibernate级联加载到session持久层中与事务回滚
- Hibernate 多对多双向关联
- PHP导出excel文件的几种方式
- Android开发中怎么把ToolBar替换成ActionBar
- 【数组】数组的增改查