Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

英语阅读题

Posted by Eli_love at 2010-05-08 17:33:19 on Problem 3425
关键在于理解这句:4.	Correct answer to a question which was already correctly answered before	+10 USD for each previous correct answerD
贴个代码仅供参考:

#include<iostream>
#include<map>
using namespace std;
map<int,int>xkey;
int main()
{
	int n,q,a,b;
	while(scanf("%d",&n)!=EOF)
	{
		xkey.clear();
		int ans=0;
		for(int i=0;i<n;i++)
		{
			scanf("%d%d%d",&q,&a,&b);
			if(xkey.find(q)==xkey.end())
				xkey[q]=0;
			else if(xkey.find(q)!=xkey.end() && a==1) xkey[q]++;
			if(a==0 && b==0) ans+=10;
			else if(a==0 && b==1) ans+=10;
			else if(a==1 && b==0) ans+=20;
			else if(a==1 && b==1) ans+=40;
		}
		map<int,int>::iterator itr;
		for(itr=xkey.begin();itr!=xkey.end();itr++)
			if((*itr).second>=1)ans+=(*itr).second*10;
		printf("%d\n",ans);
	}
	return 7;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator