## 215 - Spreadsheet Calculator

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

Moderator: Board moderators

huangry
New poster
Posts: 1
Joined: Tue Mar 12, 2002 2:00 am
Can you give me a set of Test Data of Problem 215? Thank you.

Dominik Michniewski
Guru
Posts: 834
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland
Contact:

### 215 - Spreadsheet Calculator

I try to solve this problem but I got WA a few times - could anyone help me and send some IO data ?
I use simple grammar to evaluate cells values and I loop in sheet until I can evaluate any cells. Is this algorithm wrong ?

Best rgards
DM
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)

Red Scorpion
Experienced poster
Posts: 192
Joined: Sat Nov 30, 2002 5:14 am

Code: Select all

``````input:
2 2
-A1+B1
5
-10+2
3-9
4 4
A0+A1
A1-A3
A3-A3
-9
-10
20
100-10
100+99
-99
990
299
-390+10
12
-199
-199+-99
200
4 4
A1--A2
A2-A3
A3-A3
-9
-10
20
100-10
100+99
-99
990
299
-390+10
12
-199
-199+-99
200

output:
0     1
A    -11    5
B      -8   -6

A0 = A0+A1
A1 = A1-A3

0       1      2      3
A      9       9      0      -9
B    -10    20     90   199
C    -99   990   299  -380
D     12  -199  -298   200
``````
Sorry, dominik. Padding space in my output is wrong.

Good Luck. [/java]

Dominik Michniewski
Guru
Posts: 834
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland
Contact:
Your input contains leading blanks, but statment says:

Code: Select all

``No line of input contains leading blanks. No expression contains any embedded blanks. ``
And output format should be (for unevaluated)
<cell_name>: <cell_formula>

However I got Accepted now Maybe input contains spaces at start of formula - I don't know ... I found in my code some mistakes with signs of expressions.

Thanks Red Scorpion for help

Best regards
DM
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)

Red Scorpion
Experienced poster
Posts: 192
Joined: Sat Nov 30, 2002 5:14 am
Oh, sorry Dominik.

I don't write the input-output carefully.
Congratulations you have got AC...

Dominik Michniewski
Guru
Posts: 834
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland
Contact:
I'm happy too because I got Acc on other related problem (196) too
So you help me twice in one post Congratulations !!

Best regards
DM
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)

cytmike
Learning poster
Posts: 95
Joined: Mon Apr 26, 2004 1:23 pm
Location: Hong Kong and United States
Contact:
Can anybody give me so correct test inputs? I got about 20 WA already I'm so desperate now.

What I knoe is the inputs does not have + sign in the front, expression must begin with a letter and there are no two consecutive + or - signs.

Plz help!!!!!!!
Impossible is Nothing.

Dani Rodrigo
New poster
Posts: 11
Joined: Sun Jul 18, 2004 1:39 am

### 215 WA?? (need solution for this input)

Hello!
I've received WA many times.
Anyone could write the correct output for this input, please.
The first case is problematic. Obviosly the result is 0, but it involucrates the same cell. Which is the correct interpretation?

Code: Select all

``````1 1
A0-A0
4 4
A1-A2+A3
A2
A3
6+B1
A3
5+7-8
6+A3-A2
B2+7-15+B1
1
2
3
4
C1-C3-C3-C3-15-C3
8
5
6
3 3
A1
A2
B0
B1
B2
C0
C1
C2
A0
3 3
A1
A2
B0
B1
B2
6
A1
C2
A1
6 6
1
A2
A0
C2
C4+C5+C2
B4-B3
2
A1
A1
A1
B0
B1
3
D5-C0+4
5+A2+B6-C0+E5
4
5
6
4
1
5
10
15
20
5
A2
A2
A2
A2
A3
6
B4
4
5
6
7
6 6
1
A2
A0
C2
C4+C5+C2
B4-B3
2
A1
A1
A1
B0
B1
3
D5-C0+4
5+A2+B5-C0+E5
4
5
6
4
1
5
10
15
20
5
A2
A2
A2
A2
A0
6
B4
4
5
6
7
0 0``````
My program returns:

Code: Select all

``````A0: A0-A0

0     1     2     3
A:    10    10    10    10
B:    10     4     6     2
C:     1     2     3     4
D:   -29     8     5     6

A0: A1
A1: A2
A2: B0
B0: B1
B1: B2
B2: C0
C0: C1
C1: C2
C2: A0

0     1     2
A:     6     6     6
B:     6     6     6
C:     6     6     6

A3: C2
A4: C4+C5+C2
C2: 5+A2+B6-C0+E5
E5: A3

0     1     2     3     4     5
A:     1     1     1     5    16     1
B:     2     1     1     1     2     1
C:     3    21     5     4     5     6
D:     4     1     5    10    15    20
E:     5     1     1     1     1     1
F:     6     2     4     5     6     7

``````
Thanks

sclo
Guru
Posts: 519
Joined: Mon Jan 23, 2006 10:45 pm
Location: Vancouver, BC, Canada
Contact:
Here's output from my AC program:

Code: Select all

``````A0: A0-A0

0     1     2     3
A    10    10    10    10
B    10     4     6     2
C     1     2     3     4
D   -29     8     5     6

A0: A1
A1: A2
A2: B0
B0: B1
B1: B2
B2: C0
C0: C1
C1: C2
C2: A0

0     1     2
A     6     6     6
B     6     6     6
C     6     6     6

A3: C2
A4: C4+C5+C2
C2: 5+A2+B6-C0+E5
E5: A3

0     1     2     3     4     5
A     1     1     1     5    16     1
B     2     1     1     1     2     1
C     3    21     5     4     5     6
D     4     1     5    10    15    20
E     5     1     1     1     1     1
F     6     2     4     5     6     7

``````
Do you see your error?