国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

ZOJ 3603 Draw Something Cheat

2019-11-08 02:21:27
字體:
來源:轉載
供稿:網友

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.

word guessing in draw something

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
22ABCDEFGHIJKLABCDEFGHIJKL2SAWBCVUXDTPNZQTLFJYRCGAKSample Output
ABCDEFGHIJKL

ACT

簡單題

#include<map>#include<cmath>    #include<queue>    #include<vector>#include<cstdio>    #include<cstring>    #include<algorithm>    using namespace std;#define ms(x,y) memset(x,y,sizeof(x))    #define rep(i,j,k) for(int i=j;i<=k;i++)    #define per(i,j,k) for(int i=j;i>=k;i--)    #define loop(i,j,k) for (int i=j;i!=-1;i=k[i])    #define inone(x) scanf("%d",&x)    #define intwo(x,y) scanf("%d%d",&x,&y)    #define inthr(x,y,z) scanf("%d%d%d",&x,&y,&z)    typedef long long LL;const int low(int x) { return x&-x; }const int INF = 0x7FFFFFFF;const int mod = 1e9 + 7;const int N = 1e3 + 10;int T, n, f[N], g[N];char s[N];int main(){	for (inone(T); T--;)	{		inone(n); 		rep(i, 0, 26) f[i] = INF;		rep(i, 1, n)		{			scanf("%s", s);			rep(j, 0, 26) g[j] = 0;			for (int j = 0; s[j]; j++) g[s[j] - 'A']++;			rep(j, 0, 26) f[j] = min(f[j], g[j]);		}		rep(i, 0, 26) rep(j, 1, f[i]) putchar('A' + i);		putchar(10);	}	return 0;}


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 天祝| 合肥市| 漠河县| 焦作市| 息烽县| 西昌市| 仪陇县| 峡江县| 宜州市| 桃源县| 团风县| 丁青县| 新余市| 普格县| 吉隆县| 玛多县| 巩义市| 清河县| 洮南市| 彰化县| 泸州市| 建平县| 孟津县| 台南县| 凤翔县| 芮城县| 林芝县| 马尔康县| 南江县| 峨眉山市| 沅江市| 大连市| 山阴县| 买车| 南川市| 浮山县| 广昌县| 阳东县| 新兴县| 高唐县| 合山市|