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 |
英语阅读题关键在于理解这句: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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator