← Back to topics
Topic

[b]HELP When i submit it said all wrong tests but when i do on my computer everything is working perfectly (moze i na srpskom kome je lakse)[/b]

f
filipakapro
i was doing z-procesor u have my problem in title... i checked time and memory both are good. here is code

#include <cstdlib>
#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;
int n,mesto,k,vrednost,mesto1,mesto2,bout;
string komanda,ime,ime1,ime2,ipomoc;
string imena[100];
long long int vrednosti[100];
int out[1000];
int main(int argc, char *argv[])
{
cin >> n;
bout=0;
for (int i=0;i<n;i++)
{
cin >> imena[i];
}
cin >> k;
for (int i=0; i<k;i++)
{
cin >> komanda;

if (komanda=="INC")
{
mesto=-1;
cin >> ime;
cin>>vrednost;
ipomoc=" ";
while(ipomoc!=ime)
{
mesto++;
ipomoc=imena[mesto];
}
vrednosti[mesto]=(vrednosti[mesto]+vrednost)000;
}
if (komanda=="ADD")
{
cin >> ime;
cin >> ime1;
cin >> ime2;
ipomoc=" ";
mesto=-1;
mesto1=-1;
mesto2=-1;
while(ipomoc!=ime)
{
mesto++;
ipomoc=imena[mesto];
}
ipomoc=" ";
while(ipomoc!=ime1)
{
mesto1++;
ipomoc=imena[mesto1];
}
ipomoc=" ";
while(ipomoc!=ime2)
{
mesto2++;
ipomoc=imena[mesto2];
}
vrednosti[mesto2]=vrednosti[mesto1]+vrednosti[mesto];
}
if (komanda=="MUL")
{
cin >> ime;
cin >> ime1;
cin >> ime2;
ipomoc=" ";
mesto=-1;
mesto1=-1;
mesto2=-1;
while(ipomoc!=ime)
{
mesto++;
ipomoc=imena[mesto];
}
ipomoc=" ";
while(ipomoc!=ime1)
{
mesto1++;
ipomoc=imena[mesto1];
}
ipomoc=" ";
while(ipomoc!=ime2)
{
mesto2++;
ipomoc=imena[mesto2];
}
vrednosti[mesto2]=vrednosti[mesto1]*vrednosti[mesto];
}
if (komanda=="OUT")
{
cin >> ime;
mesto=-1;
ipomoc=" ";
while(ipomoc!=ime)
{
mesto++;
ipomoc=imena[mesto];
}
out[bout]=vrednosti[mesto];
bout++;

}


}
for(int i=0;i<bout;i++)
{
cout<<out[i];
}

}
k
karakondzula
You have to cut down values using mod for every operation not just INC.