fork download
  1.  
  2. import java.awt.Point;
  3. import java.io.*;
  4. import java.lang.reflect.Array;
  5. import java.math.BigInteger;
  6. import java.util.*;
  7.  
  8. import static java.lang.Math.*;
  9.  
  10. public class HelloWorld implements Runnable{
  11.  
  12. final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
  13. final boolean LOCAL = System.getSecurityManager() == null;
  14. final String input = "input.txt";
  15. final String output = "output.txt";
  16.  
  17. BufferedReader in;
  18. PrintWriter out;
  19. StringTokenizer tok = new StringTokenizer("");
  20.  
  21. void init() throws FileNotFoundException{
  22. if (!LOCAL){
  23. in = new BufferedReader(new InputStreamReader(System.in));
  24. out = new PrintWriter(System.out);
  25. }else{
  26. in = new BufferedReader(new InputStreamReader(System.in));
  27. out = new PrintWriter(System.out);
  28. //in = new BufferedReader(new FileReader(input));
  29. //out = new PrintWriter(output);
  30. }
  31. }
  32.  
  33. String readString() throws IOException{
  34. while(!tok.hasMoreTokens()){
  35. try{
  36. tok = new StringTokenizer(in.readLine());
  37. }catch (Exception e){
  38. return null;
  39. }
  40. }
  41. return tok.nextToken();
  42. }
  43.  
  44. int readInt() throws IOException{
  45. return Integer.parseInt(readString());
  46. }
  47.  
  48. long readLong() throws IOException{
  49. return Long.parseLong(readString());
  50. }
  51.  
  52. double readDouble() throws IOException{
  53. return Double.parseDouble(readString());
  54. }
  55.  
  56. public static void main(String[] args){
  57. new Thread(null, new HelloWorld(), "", 256 * (1L << 20)).start();
  58. }
  59.  
  60. long timeBegin, timeEnd;
  61.  
  62. void time(){
  63. timeEnd = System.currentTimeMillis();
  64. System.err.println("Time = " + (timeEnd - timeBegin));
  65. }
  66.  
  67. public void run(){
  68. try{
  69. timeBegin = System.currentTimeMillis();
  70. init();
  71. solve();
  72. out.close();
  73. time();
  74. }catch (Exception e){
  75. e.printStackTrace(System.err);
  76. System.exit(-1);
  77. }
  78. }
  79.  
  80. int mod = 1000000007;
  81.  
  82.  
  83. boolean Find(char a, char b, char c, int n, int m, int k)
  84. {
  85. if (n == 0 && m == 0 && k == 0 && a == 'R' && b == 'G' && c == 'B')
  86. {
  87. return true;
  88. }
  89.  
  90. boolean res = false;
  91. if (n > 0)
  92. {
  93. res = Find(b, a, c, n - 1, m , k );
  94. if (res)
  95. return true;
  96. }
  97. if (m > 0)
  98. {
  99. res = Find(c, b, a, n, m -1 , k );
  100. if (res)
  101. return true;
  102. }
  103. if (k > 0)
  104. {
  105. res = Find(a, c, b, n, m , k-1 );
  106. if (res)
  107. return true;
  108. }
  109. return false;
  110. }
  111.  
  112. void solve() throws IOException{
  113. int n = readInt();
  114. int m = readInt();
  115. int k = readInt();
  116.  
  117. String s = readString();
  118. char[] arr = s.toCharArray();
  119.  
  120. boolean res= Find(s.charAt(0), s.charAt(1), s.charAt(2), n, m, k);
  121. if (res)
  122. {
  123. out.print("Yes");
  124. }else
  125. {
  126.  
  127. out.print("No");
  128. }
  129. }
  130. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:2:1: error: ‘import’ does not name a type
prog.cpp:3:1: error: ‘import’ does not name a type
prog.cpp:4:1: error: ‘import’ does not name a type
prog.cpp:5:1: error: ‘import’ does not name a type
prog.cpp:6:1: error: ‘import’ does not name a type
prog.cpp:8:1: error: ‘import’ does not name a type
prog.cpp:10:1: error: expected unqualified-id before ‘public’
stdout
Standard output is empty