fork download
  1. import java.io.*;
  2. import java.util.*;
  3. import java.math.*;
  4.  
  5. class p253a {
  6. public static void main(String[] args)throws IOException {
  7. Scanner sc = new Scanner(new File("input.txt"));
  8. int n = sc.nextInt();
  9. int m = sc.nextInt();
  10. StringBuilder sb = new StringBuilder();
  11. while (n > 0 && m > 0) {
  12. if (n > m) {
  13. sb.append("BG");
  14. } else {
  15. sb.append("GB");
  16. }
  17. --n;
  18. --m;
  19. }
  20. while (n-- > 0) sb.append("B");
  21. while (m-- > 0) sb.append("G");
  22. PrintWriter pw = new PrintWriter("output.txt");
  23. pw.println(sb);
  24. pw.flush();
  25. pw.close();
  26. }
  27. }
Runtime error #stdin #stdout #stderr 0.07s 380224KB
stdin
3 3
stdout
Standard output is empty
stderr
Exception in thread "main" java.io.FileNotFoundException: input.txt (No such file or directory)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:138)
	at java.util.Scanner.<init>(Scanner.java:656)
	at p253a.main(Main.java:7)