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

谁能帮我看一下,Presentation error出在哪,多谢了

Posted by wavemoon at 2005-03-28 21:01:13 on Problem 1454
#include<stdio.h>
#define N 1000
int main()
{
    int m[N];            //用来存放输入得一组数据
    int a[10000];     //用来存放计算后的数
    int len;          //计算后的数的长度 
    int i,j;          //i用于阶乘,j用于控制len 
    int tmp;          //用来存放低位的进位 
    int bit[N][10];      //用来存放0~9出现的次数 
    int t=0;

    while(scanf("%d",&m[t])!=EOF&&m[t]!=0){
        for(i=1;i<10000;i++)
        a[i]=0;
        a[0]=1;
        len=1;
        for(i=0;i<10;i++)
        bit[t][i]=0;
        for(i=2;i<=m[t];i++){
            for(j=0;j<len;j++)
            a[j]=a[j]*i;
            tmp=0;
            for(j=0;j<len;j++){
                a[j]+=tmp;
                if(a[j]<10){
                    tmp=0;
                    continue;
                }    
                else{
                    tmp=a[j]/10;
                    a[j]=a[j]%10;
                    if(j==len-1)
                    len++;
                    continue;
                }
            }
        }    
        for(j=len-1;j>=0;j--){
            if(a[j]==0)  bit[t][0]++;
            if(a[j]==1)  bit[t][1]++;
            if(a[j]==2)  bit[t][2]++;
            if(a[j]==3)  bit[t][3]++;
            if(a[j]==4)  bit[t][4]++;
            if(a[j]==5)  bit[t][5]++;
            if(a[j]==6)  bit[t][6]++;
            if(a[j]==7)  bit[t][7]++;
            if(a[j]==8)  bit[t][8]++;
            if(a[j]==9)  bit[t][9]++;
        }
        t++;                
    }
    printf("\n");
    for(j=0;j<t;j++){
        printf("%d! --\n",m[j]);
        for(i=0;i<10;i++){
            printf("    (%d)%5d",i,bit[j][i]);
            if(i==4)
            printf("\n");
        }
        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