| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
此题阴险做法~~~#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator