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 201501060326 at 2016-02-23 12:18:48 on Problem 2105
#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:
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