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 skyroamer at 2010-01-29 18:13:19 on Problem 3077
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
		int n;
		scanf("%d",&n);
		if(n<10)
		{
			cout<<n<<endl;
			continue;
		}	
		double t=n*1.0/10;
		int cnt=0;
		char a[20];
		while(1)
		{
			cnt++;
			sprintf(a,"%.0lf",t);
			sscanf(a,"%lf",&t);
			if(t/10<1)
				break;
			t/=10;	
		}
		int tmp=(int)t;
		for(int i=0;i<cnt;i++)
			tmp*=10;
		cout<<tmp<<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