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 1319. Hotel

why is Wrong answer? (use Visual C++ 2013)
Posted by Huyen Pham 22 Dec 2015 10:02
Running in my computer is OK,use use Visual C++ 2010. But in here (use Visual C++ 2013) is wrong answer. I don't understand. Help me, please!

#include <iostream>
using namespace std;

int main(){
        int a[100][100];
        int n, x=0;
        cout<<"\Input n: ";
        cin>>n;
        for(int j=n-1,i=0;j>=0;j--){
            int h=i,k=j;
            while(k<n) a[h++][k++]=++x;
        }
        for(int i=1,j=0;i<n;i++){
            int h=i,k=j;
            while(h<n) a[h++][k++]=++x;
        }
        for(int i=0; i<n ;i++){
            for(int j=0; j<n ;j++){
                cout.width(4);
                cout<<a[i][j];
            }
            cout<<endl;
        }

    cin.ignore(80,'\n');
    cin.get();
    return 0;
}