fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. private static final Random randomGenerator = new Random();
  11.  
  12. public static final void testRand() {
  13. int ans_correct = randomGenerator.nextInt(5) + randomGenerator.nextInt(5);
  14.  
  15. int ans_wrong1;
  16. do {
  17. ans_wrong1 = randomGenerator.nextInt(10);
  18. } while(ans_wrong1 == ans_correct);
  19.  
  20. int ans_wrong2;
  21. do {
  22. ans_wrong2 = randomGenerator.nextInt(10);
  23.  
  24. } while(ans_wrong2 == ans_correct);
  25.  
  26. do {
  27. ans_wrong2 = randomGenerator.nextInt(10);
  28. } while(ans_wrong2 == ans_wrong1);
  29.  
  30. System.out.printf("Correct %d WA1 %d WA2 %d\n", ans_correct, ans_wrong1, ans_wrong2);
  31. }
  32.  
  33. public static void main(String[] args) {
  34. for (int i = 0; i < 20; i++) {
  35. testRand();
  36. }
  37. }
  38.  
  39.  
  40. }
Success #stdin #stdout 0.11s 320320KB
stdin
Standard input is empty
stdout
Correct 5  WA1 8 WA2 4
Correct 4  WA1 0 WA2 1
Correct 4  WA1 0 WA2 7
Correct 5  WA1 8 WA2 3
Correct 7  WA1 8 WA2 4
Correct 4  WA1 2 WA2 5
Correct 4  WA1 3 WA2 1
Correct 4  WA1 1 WA2 7
Correct 7  WA1 0 WA2 9
Correct 4  WA1 2 WA2 4
Correct 4  WA1 6 WA2 0
Correct 4  WA1 3 WA2 0
Correct 5  WA1 7 WA2 5
Correct 5  WA1 0 WA2 5
Correct 2  WA1 1 WA2 7
Correct 8  WA1 9 WA2 2
Correct 4  WA1 8 WA2 0
Correct 6  WA1 7 WA2 8
Correct 4  WA1 0 WA2 2
Correct 2  WA1 8 WA2 7