1139_My Summary
2015-07-13 16:24
344 查看
My Summary
Description
Input
Output
Sample Input
1
10
29 B Accept
85 A Accept
94 G Wrong
98 G Accept
120 D Wrong
170 C Wrong
183 C Accept
190 D Wrong
300 A Accept
300 B Wrong
Sample Output
Accept: ABCG
Wrong: D
Description
I have a dream that one day in the foyer of the ACM/ICPC World Finals Contest , I could solve all the problems and be the champion . But things always went beyond my mind , we just solved four problems . We submitted Problem B at 29 minutes and got “ Accept “ , we passed Problem A at 85 minutes , then we got “Wrong” at 94 minutes on Problem G , but we soon got “Accept” at 98 minutes , then we submitted Problem D but got “Wrong” ….. At last , we passed Problem ABCG , and Problem D was still “Wrong” . Now I have to write a summary about the contest , I read our submission states from PC^2 , and I need to list the problem states which illustrates the “Accept” problems and “Wrong” problems , Please help me to do so .
Input
The first line of input is one integer T ( T<=100 ) , giving the number of test cases in the input . Each test case starts with a line containing a positive integer N ( N<=100 ) , representing the number of the submission states. In the next N lines contains an integer t(0<=t<=300),the submission time.Then a character ( from ‘A’ to ‘J’ ) , the ID of submission problem follows . At last is a string ( “Accept” or “Wrong” ) , the states of this submission .
Output
For each test case , output two lines , the first line print “Accept” , follow by a colon , a space , then list the name of those accept problems in alphabetical ascending order , if there is no “Accept” problem ( what a shame ! ) , just leaves it blank . The second line is about “Wrong” states , the style of which is similar to the first line . Print a blank line after each test case .
Sample Input
1
10
29 B Accept
85 A Accept
94 G Wrong
98 G Accept
120 D Wrong
170 C Wrong
183 C Accept
190 D Wrong
300 A Accept
300 B Wrong
Sample Output
Accept: ABCG
Wrong: D
#include<iostream> using namespace std; int main() { // freopen("in.txt","r",stdin); int n; scanf("%d",&n); while(n--) { int times,a,i; char s[10],b; int ans[10]={0},visit[10]={0}; scanf("%d",×); for(i=0;i<times;i++) { scanf("%d %c %s",&a,&b,s); if(s[0]=='A' && !visit[b-'A']) ans[b-'A']=1,visit[b-'A']=1; if(s[0]=='W' && !visit[b-'A']) ans[b-'A']=2; } printf("Accept: "); for(i=0;i<10;i++) { if(ans[i]==1) printf("%c",i+'A'); } printf("\n"); printf("Wrong: "); for(i=0;i<10;i++) { if(ans[i]==2) printf("%c",i+'A'); } printf("\n\n"); } return 0; }
相关文章推荐
- Android PullToRefresh 实战(ListView)
- Less
- 实现数字转换RMB大写~
- static类型指针使用中的问题(AVPicture 类型内存释放)
- linux SWIG C++转换为JAVA
- 如何提高程序效率
- HDU 1166 (敌兵布阵)
- pthread_create()
- addStretch 布局平均分配空间
- Leetcode47: Palindrome Linked List
- VS 演进
- 图像相似度算法--SIFT算法详解
- 模拟登陆
- NSstring封装
- 初识Nginx,简单配置实现负载均衡(ubuntu + Nginx + tomcat)
- 单例模式
- JAVA笔记整理(二),下载安装JDK
- sqlserver权限体系(下)
- Pinyin4j使用手册,HanyuPinyinVCharType的意义
- GRE写作必备句型