UPC 2017 Summer Training 1
来源:互联网 发布:女鞋淘宝鞋店知乎 编辑:程序博客网 时间:2024/05/19 04:52
B - Unlucky Teacher
Ali is a teacher in one of Kuwait universities. Last week he made a multi-choice test for his students. After the test, he marked some papers before collecting all papers and going home. However, he discovered that he forgot the solution key at the university. He is sure that he didn't make any mistake in correcting papers, so in order to complete the correction process, he decided to extract the solution key from the papers that have already been marked.
Ali knows that each question should have one and only one correct choice, can you help him with extracting the correct answers for all the questions?
The first line of the input is a single integer T, the number of test cases. Each test case will consist of several lines. The first line contains 2 integers separated by a single space: (1 ≤ Q ≤ 100 and 0 ≤ M ≤ 100) representing the number of questions in the test, and the number of the corrected papers, respectively. Each of the next M lines will contain 2Q upper case letters separated by single spaces:qi ai ( {'A','B','C','D'} and {'T','F'}) representing the student answer for the ith question (from a corrected paper) and the status of the student answer 'T' if it is True or 'F' if it is False.
For each test case, print a single line contains Q characters separated by single spaces: {'A','B','C','D','?'}) representing the correct answer ofith question that could be extracted from the given corrected papers or '?' in case it could not be determined.
23 2A F B F C TB T C F D F1 3A FB FC F
B ? CD
#include<stdio.h>#include<string.h>int main(){char b[210][220];int d[10];int t,i,j,m,q,k,l,temp,flag,iq;while(scanf("%d",&t)!=EOF){while(t--){scanf("%d%d",&m,&q);
getchar();for(k=0;k<q;k++) {for(j=0;j<2*m-1;j++)scanf("%c ",&b[k][j]);//按照格式输入scanf("%c",&b[k][j]);//最后一个后边没空格getchar();//吸收回车}iq=0;while(iq<2*m){d[0]=-1;d[1]=-1;d[2]=-1;d[3]=-1;for(j=0;j<q;j++){if(b[j][iq+1]=='F'){d[b[j][iq]-'A']=0; }else if(b[j][iq+1]=='T')d[b[j][iq]-'A']=1;}flag=0;for(i=0;i<4;i++){if(d[i]==1 && iq==0){flag=1;char cc='A'+i;printf("%c",cc);}else if(d[i]==1 && iq!=0){flag=1;char cc='A'+i;printf(" %c",cc);}}l=0;int ll;if(!flag){for(i=0;i<4;i++){if(d[i] == -1){ll=i;l++;}}if(l==1 && iq==0){char cc='A'+ll;printf("%c",cc);}else if(l==1 && iq!=0){char cc='A'+ll;printf(" %c",cc);}else if(l>1 && iq==0)printf("?");else if(iq>1 && iq!=0 )printf(" ?");}iq=iq+2;}puts("");}}return 0;}PS:
- UPC 2017 Summer Training 1
- UPC 2017 Summer Training 1
- UPC 2017 Summer Training 1
- UPC 2017 Summer Training 1
- UPC 2017 Summer Training 5
- UPC 2017 Summer Training 5
- UPC 2017 Summer Training 6 A,D,I
- UESTC 2017 Summer Training #1 Div.2
- BUPT 2017 summer training (for 16) #1
- 2017 Summer Training Day1
- BUPT Summer training 1 总结
- SDKD 2017 Summer Single Training #01(训练赛1)
- 2017 Xian ACM Summer Training Warm-up Exercise 1
- UESTC 2017 Summer Training #2 Div.2
- E- Refraction----(2015 NEUQ_ACM summer training #1)
- ecjtu-summer training #1 F (UVA 11461)
- Tri_integral Summer Training 6
- BUPT-SUMMER-TRAINING-搜索
- 【补充】Linux-2.6.22.6 makefiles.txt翻译
- 用position: sticky 实现粘性元素区域悬浮效果
- Python API快餐教程(1)
- <<最小割模型在信息学竞赛中的应用>>的学习心得
- Handler的常见用法
- UPC 2017 Summer Training 1
- Ubuntu——触控板太灵敏
- 微信公众号授权登录(java实现)
- [Leetcode] 332. Reconstruct Itinerary 解题报告
- 水果笔试题
- POJ2479&poj2593-双连续子段和-Maximum sum
- 基于Servlet&Jsp的网上书店设计(一)
- HDU 2822 Dogs
- 贪心算法之硬币问题