fork download
  1. program lucydice;
  2. { constraints }
  3. const
  4. MAXN = 100;
  5.  
  6. { input data }
  7. var
  8. N, i : longint;
  9. A, B, C, D, valorepunteggio1, valorepunteggio2 : array[0..MAXN-1] of longint;
  10. W1, W2, X : longint;
  11.  
  12. begin
  13. {
  14.   uncomment the following lines if you want to read/write from files
  15.   assign(input, 'input.txt'); reset(input);
  16.   assign(output, 'output.txt'); rewrite(output);
  17. }
  18.  
  19. { read N in the first line }
  20. readln(N);
  21. { read the four dice of each round }
  22. for i:=0 to N-1 do
  23. begin
  24. readln(A[i], B[i], C[i], D[i]);
  25. if A[i]>B[i] then valorepunteggio1[i]:=B[i]*10+A[i]
  26. else if A[i]<B[i] then valorepunteggio1[i]:=A[i]*10+B[i]
  27. else if A[i]=B[i] then valorepunteggio1[i]:=A[i];
  28. if C[i]>D[i] then valorepunteggio2[i]:=D[i]*10+C[i]
  29. else if C[i]<D[i] then valorepunteggio2[i]:=C[i]*10+D[i]
  30. else if C[i]=D[i] then valorepunteggio2[i]:=C[i];
  31.  
  32. end;
  33.  
  34. W1 := 0; W2 := 0; X := 0;
  35.  
  36. { insert your code here }
  37. for i:=0 to N-1 do
  38. begin
  39. if (valorepunteggio1[i] div 10 >=1) and (valorepunteggio2[i] div 10 <1) then W2:=W2+1;
  40. if (valorepunteggio2[i] div 10 >=1) and (valorepunteggio1[i] div 10 <1) then W1:=W1+1;
  41. if (valorepunteggio1[i] div 10 <1) and (valorepunteggio2[i] div 10 <1) then if valorepunteggio1[i]>valorepunteggio2[i] then W1:=W1+1
  42. else if valorepunteggio1[i]<valorepunteggio2[i] then W2:=W2+1
  43. else if valorepunteggio1[i]=valorepunteggio2[i] then X:=X+1;
  44. if (valorepunteggio1[i] div 10 >=1) and (valorepunteggio2[i] div 10 >=1) then if valorepunteggio1[i]>valorepunteggio2[i] then W1:=W1+1
  45. else if valorepunteggio1[i]<valorepunteggio2[i] then W2:=W2+1
  46. else if valorepunteggio1[i]=valorepunteggio2[i] then X:=X+1;
  47. end;
  48. { write the three results in a single line }
  49. writeln(W1, ' ', W2, ' ', X);
  50. end.
  51.  
Success #stdin #stdout 0s 544KB
stdin
4
2 1 1 2
4 4 6 5
3 6 5 5
6 5 4 6

stdout
2 1 1