| ||||||||||
| 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 <stdio.h>
#include <string.h>
int find(int n)
{
if(n==0)
return 1;
else
return 2*find(n-1);
}
int main()
{
int i,k,value;
char s[1000];
scanf("%d",&k);
getchar();
while(k--)
{
gets(s);
value=0;
for(i=0; i<strlen(s); i++)
{
if(i==7)
{
value+=(s[i]-'0')*find(7-(i%8));
printf("%d",value);
value=0;
}
else
{
if((i-7)%8==0)
{
value+=(s[i]-'0')*find(7-(i%8));
printf(".%d",value);
value=0;
}
else
{
value+=(s[i]-'0')*find(7-(i%8));
}
}
}
printf("\n");
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator