ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1313. Some Words about Sport

kalisha Why error? Test #2 WA [3] // Problem 1313. Some Words about Sport 24 Dec 2008 17:07
#include <stdio.h>
//#include <conio.h>

int main()
{
    int n;
    //FILE *f;
    int i,j,k;
    int a[101][101];

    //f=fopen("1313.txt","r");
    //fscanf(f,"%d",&n);
    scanf("%d",&n);

    for (i=1;i<=n;i++)
    {
        for (j=1;j<=n;j++)
        {
            //fscanf(f,"%d",&a[i][j]);
            scanf("%d",&a[i][j]);
        }
    }
    printf("%d ",a[1][1]);

    for (i=2;i<=n;i++)
    {
        printf("%d ",a[i][1]);
        if (i>2)
        {
            for (j=i-1,k=2;k<=i-1;j--,k++)
            {
                printf("%d ",a[j][k]);
            }
        }
        printf("%d ",a[1][i]);
    }

    for (i=2;i<n;i++)
    {
        printf("%d ",a[n][i]);
        if (i<n-1)
        {
            for (j=n-1,k=i+1;k<=n-1;k++,j--)
            {
                printf("%d ",a[j][k]);
            }
        }
        printf("%d ",a[i][n]);
    }
        printf("%d ",a[n][n]);

    //getch();
    return 0;
}
Ramzes2 (Cherkasy NU) Re: Why error? Test #2 WA [2] // Problem 1313. Some Words about Sport 31 Dec 2008 01:47
Try this test:
1
1
kalisha Re: Why error? Test #2 WA // Problem 1313. Some Words about Sport 31 Dec 2008 01:49
+1
Md. Kamrul Islam Re: Why error? Test #2 WA // Problem 1313. Some Words about Sport 6 Mar 2009 10:55
I did not consider it first. Really helped!