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 askhelp at 2004-08-15 12:13:53 on Problem 1761
#include <fstream>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
using namespace std;

ifstream fin("1761a.in");


int n;

int main()
{
	int i,j;
	fin>>n;
	int time;
	string name;
	char pro,rslt;
	vector<string> sub[9];

		int sum[9];
		int sumtime[9];
		map<char,int> pass;
		map<string,int> alltime[9];
		map<string,int> everyone[9];

		for(char ch='A';ch<'J';ch++)
		{
			pass[ch]=0;
		}

///////////////////////////////////////////////////////////////////////////////////	
		///  check if this person has been solved this problem ////
	for(i=0;i<n;i++)
	{
		fin>>time>>name>>pro>>rslt;
		int flag=1;
		for(j=0;j<sub[pro-65].size();j++)
		{
			if(name==sub[pro-65][j])
			{
				flag=0;
				break;
			}
		};
		if(flag==0)
			continue;
		else
		{
			if(rslt=='A')
				sub[pro-65].push_back(name);
		}
	////////////////////////////////////////////////////////////////////////////////
		///
		everyone[pro-65][name]++;
		if(rslt=='A')
		{
			pass[pro]++;
			sum[pro-65]+=everyone[pro-65][name];
			sumtime[pro-65]+=time;
		}
	}


//////////////////////////////////////////////////////////////////////////////////////////////////////
	///   display the result  
	for(map<char,int>::iterator it=pass.begin(); it != pass.end(); it++)
	{
		
		cout << it->first << " " << it->second;
		if(pass[it->first]!=0)
		{
			cout<<" "<<setprecision(2)<<fixed<<sum[it->first-65]*1.0/it->second<<" "<<sumtime[it->first-65]*1.0/it->second<<endl;
		}
		else
			cout<<endl;
	}



}

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