Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:改了一个变量的定义,过了(int sum[9] 改为 float sum[9]),In Reply To:改了一个变量的定义,过了(int sum[9] 改为 float sum[9]), Posted by:zhjh008 at 2004-08-15 17:05:21 > //#include <fstream> > > #include <iostream> > #include <string> > #include <vector> > #include <map> > #include <iomanip> > using namespace std; > > //ifstream cin("1761a.in"); > > > int n; > > int main() > { > int i,j; > cin>>n; > int time; > string name; > char pro,rslt; > vector<string> sub[9]; > //////////////////该在这里! > float sum[9]; > float sumtime[9]; > map<char,int> pass; > map<string,int> everyone[9]; > > for(char ch='A';ch<'J';ch++) > { > pass[ch]=0; > } > //int h=2147483647; > //cout<<h<<endl; > /////////////////////////////////////////////////////////////////////////////////// > for(i=0;i<n;i++) > { > cin>>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); > } > //////////////////////////////////////////////////////////////////////////////// > //cout<<time<<" "<<name<<" "<<pro<<" "<<rslt<<endl; > everyone[pro-65][name]++; > //cout<<pro<<" "<<name<<" "<<alltime[pro-65][name]<<endl; > > if(rslt=='A') > { > pass[pro]++; > sum[pro-65]+=everyone[pro-65][name]; > sumtime[pro-65]+=time; > //cout<<pro<<" "<<sumtime[pro-65]<<")"<<endl; > } > } > > > ////////////////////////////////////////////////////////////////////////////////////////////////////// > for(map<char,int>::iterator it=pass.begin(); it != pass.end(); it++) > { > cout<<it->first<<" "<<it->second; > if(it->second!=0) > { > ////////////相应的这里也该了一下! > cout<<" "<<setprecision(2)<<fixed<<sum[it->first-65]/it->second<<" "<<sumtime[it->first-65]/it->second<<endl; > } > else > cout<<endl; > } > > > > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator