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 |
求真相!为什么是"WRONG ANSWER"!?!#include <iostream> using namespace std; struct Card{ int n; double oper; }; int count(double oper,int n) { if((oper - 1.0/n) < 0) return 1; else return (1 + count(oper - 1.0/n,n + 1)); } int main() { Card card[10001]; int i,j; for(i = 0;card[i - 1].oper != 0;i++) cin>>card[i].oper; i--; for(j = 0;j < i;j++) card[j].n = count(card[j].oper,2); for(j = 0;j < i;j++) cout<<card[j].n<<" card(s)"<<endl; return 0; } 十分不明白,运营的结果没有错误。 难不成是我理解错题目的意思了? Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator