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

测了许多数据都行啊 咋还不过那

Posted by 1291409040 at 2009-12-17 18:55:58 on Problem 3077
#include<iostream>
#include<string.h>
#include<math.h>
using namespace std;
int main()
{
	char a[9];
	int n=0,l=0,sum=0,k=0;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a;
		l=strlen(a);
		if((a[1]-'0')<4)k=a[0]-'0';
		if((a[1]-'0')>4)k=(a[0]-'0')+1;
		if(a[1]-'0'==4)
		{
			if(l==2)k=a[0]-'0';
			for(int m=2;m<l;m++)
			{
				if((a[m]-'0')!=0)
				{
					k=a[0]-'0'+1;
					break;
				}
				else
					k=a[0]-'0';
			}
		}
		sum=k*pow(10.0,l-1);
		cout<<sum<<endl;
		sum=0;
	}
	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