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

Re:贴个挫代码(ac)

Posted by 799098386 at 2012-07-19 16:05:45 on Problem 1519
In Reply To:贴个挫代码(ac) Posted by:799098386 at 2012-07-19 16:05:39
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
    int t,i,j,k,g,h,n;
    char a[10001];
    while(~scanf("%s",a))
    {
       h=0;
      n=strlen(a);
      if(n==1 && a[0]=='0')
        break;
  else
               
    {  
        for(i=0;i<n;i++)
                  
           h=h+a[i]-'0';
                  h=h%9;
        if(h==0)printf("9\n");
                else printf("%d\n",h);
    }
 }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