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

WA无数次的注意了

Posted by tlxxzj at 2014-02-25 22:22:30 on Problem 1001 and last updated at 2014-02-26 12:48:19
0.1000 1

答案是 .1

小数点前面不要0,小数点要写成.xxxxx,而不是0.xxxxx

#include <iostream>
#include <algorithm>
#include <utility>
#include <cmath>
#include <queue>
#include <string>
#include<iomanip>
using namespace std;
int main()
{
	int i,j,k,l,z,m,n,a,b,x,y,s;
	char r[10];
	while(cin>>r>>n){
		int num[200]={0};
		for(i=0;i<6&&r[i]!='.';i++)if(r[i]-'0')break;
		for(j=5;j>=0&&r[j]!='.';j--)if(r[j]-'0')break;
		for(k=0;k<6;k++)if(r[k]=='.')l=j-k;
		for(k=i,s=0;k<=j;k++){
			if(r[k]=='.')continue;
			s=s*10+(r[k]-'0');
		}
		if(s==0){cout<<0<<endl;continue;}
		num[0]=1;
		for(i=0;i<n;i++){
			b=0;
			for(j=0;j<199;j++){
				a=num[j]*s+b;
				num[j]=a%10;
				b=a/10;
			}
		}
		for(i=199;i>=0;i--){
			if(l*n-1==i){cout<<'.'<<num[i--];break;}
			if(num[i])break;
		}
		for(;i>=0;i--){
			if(l*n-1==i)cout<<'.';
			cout<<num[i];
		}
		cout<<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