## 10033 - Interpreter

All about problems in Volume C. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Its tough to generate inputs manually. However, here are some random cases. U can try them.

Input:
Code: Select all
`2299492495399492495399283279689078100000000000456789234453125175183256012100000`

Output:
Code: Select all
`165`

Hope these help.

EDIT : The wrong input set is removed. Sorry for posting it.
Last edited by Jan on Thu Dec 07, 2006 1:05 pm, edited 1 time in total.
Ami ekhono shopno dekhi...
HomePage
Jan
Guru

Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh

### 10033 - input

Anyone can tell me if the following code solve correctly the input of problem 10033???

void CPU::read()
{
int w = 0;
while(1)
{
ram[pc][w] = getchar();
while(ram[pc][w] != '\n')
{
w++;
ram[pc][w] = getchar();
}

if(ram[pc][0] == '\n')
break;
else
{
ram[pc][w] = 0;em string
w = 0;
pc++;
}
}
}
beloni
Learning poster

Posts: 66
Joined: Thu Jan 05, 2006 1:41 pm
Location: Pelotas, RS, Brazil

### 10033 RTE Please help me Jan!!!

I have this sample input posted by JAN:
1

299
492
279
283
078
100
123
345

first code: move register 9 with the value 9
second: mul by two the content of register 9
third: move rigister 7 with the value 9
fourth: move register 8 with value 3

fifth: jump to ram position in register 7 if register 8 is not zero
so... in this case reg 7 contains 9, reg 8 conteisn 3 and reg 9 contains 18.
but the ram position in reg 7 is 000 and we have a infinity loop!!!
beloni
Learning poster

Posts: 66
Joined: Thu Jan 05, 2006 1:41 pm
Location: Pelotas, RS, Brazil

### a test input

3

299
492
495
399
492
495
399
283
279
689
078
100
000
000
000

456
789
234
453
125
175
183
256
012
100
000

299
492
279
283
078
100
123
345
beloni
Learning poster

Posts: 66
Joined: Thu Jan 05, 2006 1:41 pm
Location: Pelotas, RS, Brazil

My AC code goes into an infinite loop for this test case as well. I guess you can safely assume the judge contains no such cases.
chunyi81
A great helper

Posts: 293
Joined: Sat Jun 21, 2003 4:19 am
Location: Singapore

thanks
so... can you give to me an sample input???
beloni
Learning poster

Posts: 66
Joined: Thu Jan 05, 2006 1:41 pm
Location: Pelotas, RS, Brazil

### Hmm

Why don't you make bigger array size?

tmdrbs6584
Learning poster

Posts: 98
Joined: Sat Jan 21, 2006 12:45 pm
Location: Busan,Corea(Republic of)

I sent my solution to this problem, and I got ACC, but the last test case makes my program infinite-looping... that's weird... but I have no time to test that manually.

jedihe
John Herre
New poster

Posts: 6
Joined: Sat Jun 10, 2006 6:35 pm
Location: Bogota, Colombia

I guess, beloni wanted to say
but the ram position in reg '9' is 000 and we have a infinity loop!!!

he is right with that, anyway.. this input is faulty!
fahim
#include <smile.h>

smilitude
Experienced poster

Posts: 137
Joined: Fri Jul 01, 2005 12:21 am

Thanks beloni for showing me the error. Those cases were randomly generated, and somehow my old code(which was accepted, too) generated those outputs. But my current code goes into an infinite loop for the case. Sorry for posting such faulty case .
Ami ekhono shopno dekhi...
HomePage
Jan
Guru

Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh

### 10033 is making me crazy!

I have read and re-read this problem so many times that I already know it by heart.

I have searched at the forum and found this sample input and output posted by Jan:

Input:
456
789
234
453
125
175
183
256
012
100
000

Output:
5

Here's the link where I found this input/output:
http://online-judge.uva.es/board/viewto ... ight=10033

What's my problem?
I can't understand how the output can be 5.

First instruction: multiply by 6 the content of register 5
Second: multiply the register 8 content by the content of register 9
Third: set the register 3 the value 4
Fourth: multiply by 3 the content of register 5
Fifth: isn't interpreted
Sixtth: isn't interpreted
Seventh: isn't interpreted
Eighth: set the register 5 the value 6
Nineth: don't go to register 1, beacause the content of register 2 is 0
Tenth: halt interpreter

So we have 6 instructions.
Why is the correct output is 5?
Bandrosh
New poster

Posts: 7
Joined: Wed Dec 20, 2006 10:00 pm

Actually, my program stops when 125 is reached. It is the halt instruction, so the program finishes there, and the subsequent lines should be ignored. This way we have 5 instructions executed, including the 125.
Thiago Sonego Goulart - UFMG/Brazil
tgoulart
New poster

Posts: 42
Joined: Sat Oct 21, 2006 8:37 am
Location: Alegrete, Brazil

u have accepted? in ur question?
hehe thnks man, i
Bandrosh
New poster

Posts: 7
Joined: Wed Dec 20, 2006 10:00 pm

Bandrosh wrote:u have accepted? in ur question?
hehe thnks man, now i have win one Sig Error heheh Ipm staying more crazy
Bandrosh
New poster

Posts: 7
Joined: Wed Dec 20, 2006 10:00 pm

Yes, I got accepted and I hardly doubt that cases like this one would be in the judge's input, unless it's the last case, because of the lines that you have to ignore.

Try to recode your program, you might have done some mistakes, and don't forget that all results are mod 1000!
Thiago Sonego Goulart - UFMG/Brazil
tgoulart
New poster

Posts: 42
Joined: Sat Oct 21, 2006 8:37 am
Location: Alegrete, Brazil

PreviousNext

Return to Volume C

### Who is online

Users browsing this forum: No registered users and 0 guests