fork download
  1. Program gridtoll;
  2.  
  3. { constraints }
  4. const
  5. MAXT = 100000;
  6.  
  7. { input data }
  8. var
  9. T, i : longint;
  10. N, M, K : array[0..MAXT-1] of int64;
  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. readln(T);
  20. for i:=0 to T-1 do
  21. readln(N[i], M[i], K[i]);
  22.  
  23. for i:=0 to T-1 do
  24. begin
  25. if K[i]=N[i]*M[i]-1 then writeln('YES')
  26. else writeln('NO'); { print the answer to the i-th query }
  27. end;
  28. end.
  29. .
Success #stdin #stdout 0s 544KB
stdin
2
2 3 5
1 1 0

stdout
YES
YES