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

哪位高手给看一下吧,怎么是RE?给的数据都测过了

Posted by Greepry at 2008-11-20 21:41:45 on Problem 1565
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	char a;
	double sum;
	int i,j,s=1,num[50];
	while(s>0)
	{
		s=0;
		for(i=0;;i++)
		{
			a=cin.get();
			if(a=='\n') break;
			else 
			{
				num[i]=a-48;
				s+=num[i];
			}
		}
		if(s==0) break;
		sum=0;
		for(j=0;j<i;j++) sum+=num[j]*(pow((float)2,i-j)-1);
		cout << sum << endl;
	};
	system("pause");
}

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