南邮-My Summary

                                                  My Summary

时间限制(普通/Java):1000MS/3000MS          运行内存限制:65536KByte
总提交:115            测试通过:35

描述

         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 .

输入

         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 .

输出

         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 .

样例输入

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

样例输出

Accept: ABCG
Wrong: D

题目来源

NUPT ACM

#include<iostream>
#include<set>
#include<string>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n,i;
		cin>>n;
		int temp;
		string str;
		set<char> ch1,ch2;
		set<char>::iterator p,q;
		int count=0;
		char c;
		for(i=0;i<n;i++)
		{
			cin>>temp>>c>>str;
			if(str=="Accept")
				ch1.insert(c);
			else
				ch2.insert(c);
		}
		cout<<"Accept: ";
		for(p=ch1.begin();p != ch1.end();p++)
			cout<<*p;
		cout<<endl;
		cout<<"Wrong: ";
		for(p=ch2.begin();p != ch2.end();p++)
		{
			q=ch1.find(*p);//find函数:如果容器中存在*p,则返回指向该元素的迭代器,如果不存在,则返回超出末端的迭代器。
			if(q == ch1.end())
				cout<<*p;
		}
		cout<<endl<<endl;
	}
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值