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 1506. Columns of Numbers

WA 10
Posted by Ilia 26 Apr 2011 20:29
What's incorrect?????

int main()
{
    int n, k;
    scanf("%d %d", &n, &k);

    vector<int> mas(100);

    mas.assign(100, -1);
    for (int i=0; i<n; i++)
        scanf("%d", &mas[i]);
    int s=n/k;
    if(n%k!=0) s++;

    for (int i=0; i<s; i++)
    {
        for(int j=0; j<k; j++)
            if (mas[s*j+i]!=-1)
            printf("%4d", mas[s*j+i]);
        printf("\n");
    }

  return 0;
 }

Edited by author 26.04.2011 20:30
Re: WA 10
Posted by Uzbek boy 4 Dec 2012 17:49
vector<int>mas;
mas.assign(111,-1);