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

最终的不幸,还是WA了。。。求解

Posted by Muye007 at 2013-10-03 06:03:41 on Problem 3173
#include <stdio.h>
int a[22][22];
int main()
{
    int n,s,i,j,count;
    scanf("%d%d",&n,&s);
    a[0][0]=s;
    printf("%d",s);
    for(i=1;i<n;i++)
    {
        a[0][i]=a[0][i-1]+i;
        if(a[0][i]>9) a[0][i]%=9;
        printf(" %d",a[0][i]);
    }
    printf("\n");
    for(i=1;i<n;i++)
    {
        for(j=1;j<2*i;j++)
            printf(" ");
        for(j=i;j<n;j++)
        {
            a[i][j]=a[i-1][j]+1;
            if(a[i][j]>9) a[i][j]%=9;
            printf(" %d",a[i][j]);
        }
        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