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 1220. Stacks

Nguyen Dinh Tu (DHSP) Please, help me. Why Compilation Error in C++ ? [4] // Problem 1220. Stacks 19 Jul 2005 17:00
#include <iostream.h>
const int max=100000;
using namespace std;

int main()
{
int Stack[max];
long Value[max];
long n;
long m;
char c;
int t;
char k;
cin>>n;
while (n > 0)
  {
    cin>>c>>c;
    if (c == 'U')
      {
         cin>>k>>k;
        m++;
        cin>>Stack[m]>>Value[m];
      }
    else
      {
        cin>>k;
        cin>>t;
        for (long i = m; i>=1; i--)
          if (Stack[i] == t)
            {
              Stack[i] = 0;
              cout<<Value[i]<<endl;
              break;
            }
      }
    n--;
  }
return 0;
}

Edited by author 19.07.2005 17:01
qwerty I corrected your code: (+) [3] // Problem 1220. Stacks 19 Jul 2005 18:32
#include <iostream>
#define max 100000
using namespace std;

int main()
{
int Stack[max];
long Value[max];
long n;
long m;
char c;
int t;
char k;
cin>>n;
while (n > 0)
{
cin>>c>>c;
if (c == 'U')
{
cin>>k>>k;
m++;
cin>>Stack[m]>>Value[m];
}
else
{
cin>>k;
cin>>t;
for (long i = m; i>=1; i--)
if (Stack[i] == t)
{
Stack[i] = 0;
cout<<Value[i]<<endl;
break;
}
}
n--;
}
return 0;
}
Nguyen Dinh Tu (DHSP) Thank you very much ! // Problem 1220. Stacks 20 Jul 2005 16:33
I don't know C, C++ much.
I used Dev-C++ to write my error code
-> Compilation Success but Submit with CE.
What  programming do you use to submit with C++?
Thanks.

Edited by author 20.07.2005 16:35
Nguyen Dinh Tu (DHSP) Thank you very much ! [1] // Problem 1220. Stacks 20 Jul 2005 16:34
I don't know C, C++ much.
I used Dev-C++ to write my error code
-> Compilation Success but Submit with CE.
What programming do you use to submit with C++?
Thanks.
qwerty I use Dev-Cpp and Borland C++ (-) // Problem 1220. Stacks 20 Jul 2005 22:36