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

求真相!为什么是"WRONG ANSWER"!?!

Posted by ecbd2010 at 2011-11-22 15:23:39 on Problem 1003
#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:
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