PDA

View Full Version : i don't get it

Ste94
07-27-2009, 04:54 PM

The year is 2055. Little Z is now full grown man, and works in a successful programmers company called "Rainyday". One day when he came home, he found his little son Z with dominos. Z needed some time to remind himself for what those boards serve, but in the end he remembered and decided to have a liitle play with them (in them memory of old good times). Soon he realised that he had problem with their combining.Help little Z to combine the largest array possible of the dominos,considering the well-known rules.

INPUT:
Input is read from standard input.In the first line is number N (number of dominos, N<=100). In the next N lines are read two numbers( 0<= X,Y <= 6) which represent the numbers of a specific domino.

OUTPUT:
To the standard output you should output the largest possible array that can be combined with the given dominos.

Input:
3
1 3
3 2
2 6

Output:
3

I wrote program like this:

program zdom;
var n,a,b,c:integer;
x,y:array [1..100] of integer;
begin
for a:=1 to n do
begin
end;
b:=0;
for c:=1 to n do
begin
if (x[c]=y[c]) or (y[c]=x[c]) or (x[c]=x[c]) or (y[c]=y[c]) then
begin
b:=b+1;
end;
end;
writeln(b);
end.

Task has 15 tests and only 7 is correct when i check with my program. And my question is what is wrong with my program.

it career
07-28-2009, 10:45 AM
x[c]=x[c] will be always true ? what languge is it ?

Millenia
07-28-2009, 10:46 AM