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 1521. War Games 2

Compilation Error
Posted by Shelest Pavlo 8 Apr 2009 15:20
I receive compilation error but in Borland C++ all ok.
What is problem?

#include<iostream.h>
#include<stdlib.h>
#include<string.h>

void main()
{
    unsigned long N, K, i, position;
    char * mas[30000];
    char * mas1[30000];
    char * mas2[30000];
    char * mas3[10000];

    cin>>N;
    cin>>K;


    for( i = 1 ; i <= N; i++)
    {
      if(i < 30000)
      {
        ultoa(i, mas[i - 1], 10/* size(i)*/);
      }
      else if (i < 60000)
      {
        ultoa(i,  mas1[i - 30001] , 10/* size(i)*/);
      }
      else if (i < 90000)
      {
        ultoa(i,  mas2[i - 60001] , 10/*size(i)*/);
      }
      else if (i < 100000)
      {
        ultoa(i,  mas3[i - 90001] , 10/*size(i)*/);
      }
    }

    i = 0;
    position = 0;
    int step = 0;
    while( i < N)
    {
        while(step < K)
        {
            if(position >= N)
                position = position - N;
            if(position < 30000)
            {
                if(strcmp(mas[position], "0") != 0)
                    step ++;
            }
            else if(position < 60000)
            {
                if(strcmp(mas[position - 30000], "0") != 0)
                    step ++;
            }
            else if(position < 90000)
            {
                if(strcmp(mas[position - 60000], "0") != 0)
                    step ++;
            }
            else if(position < 100000)
            {
                if(strcmp(mas[position - 90000], "0") != 0)
                    step ++;
            }
            position++;
        }
        step = 0;
        position --;
        if(position < 30000)
        {
            cout<<mas[position];
            mas[position] = "0";
        }
        else if(position < 60000)
        {
            cout<<mas1[position];
            mas1[position] = "0";
        }
        else if(position < 90000)
        {
            cout<<mas2[position];
            mas2[position] = "0";
        }
        else if(position < 100000)
        {
            cout<<mas3[position];
            mas3[position] = "0";
        }
        cout<<" ";
        i++;
        position ++;
    }
}