fork download
  1. import java.io.BufferedWriter;
  2. import java.io.IOException;
  3. import java.io.InputStream;
  4. import java.io.OutputStream;
  5. import java.io.OutputStreamWriter;
  6. import java.io.PrintWriter;
  7. import java.io.Writer;
  8. import java.util.InputMismatchException;
  9.  
  10. class ADDMULT
  11. {
  12. private static class InputReader
  13. {
  14. private InputStream stream;
  15. private byte[] buf = new byte[1024];
  16. private int curChar;
  17. private int numChars;
  18. private SpaceCharFilter filter;
  19.  
  20. public InputReader(InputStream stream)
  21. {
  22. this.stream = stream;
  23. }
  24.  
  25. public int read()
  26. {
  27. if (numChars == -1)
  28. throw new InputMismatchException();
  29. if (curChar >= numChars)
  30. {
  31. curChar = 0;
  32. try
  33. {
  34. numChars = stream.read(buf);
  35. } catch (IOException e)
  36. {
  37. throw new InputMismatchException();
  38. }
  39. if (numChars <= 0)
  40. return -1;
  41. }
  42. return buf[curChar++];
  43. }
  44.  
  45. public int readInt()
  46. {
  47. int c = read();
  48. while (isSpaceChar(c))
  49. c = read();
  50. int sgn = 1;
  51. if (c == '-')
  52. {
  53. sgn = -1;
  54. c = read();
  55. }
  56. int res = 0;
  57. do
  58. {
  59. if (c < '0' || c > '9')
  60. throw new InputMismatchException();
  61. res *= 10;
  62. res += c - '0';
  63. c = read();
  64. } while (!isSpaceChar(c));
  65. return res * sgn;
  66. }
  67.  
  68. public String readString()
  69. {
  70. int c = read();
  71. while (isSpaceChar(c))
  72. c = read();
  73. StringBuilder res = new StringBuilder();
  74. do
  75. {
  76. res.appendCodePoint(c);
  77. c = read();
  78. } while (!isSpaceChar(c));
  79. return res.toString();
  80. }
  81. public double readDouble() {
  82. int c = read();
  83. while (isSpaceChar(c))
  84. c = read();
  85. int sgn = 1;
  86. if (c == '-') {
  87. sgn = -1;
  88. c = read();
  89. }
  90. double res = 0;
  91. while (!isSpaceChar(c) && c != '.') {
  92. if (c == 'e' || c == 'E')
  93. return res * Math.pow(10, readInt());
  94. if (c < '0' || c > '9')
  95. throw new InputMismatchException();
  96. res *= 10;
  97. res += c - '0';
  98. c = read();
  99. }
  100. if (c == '.') {
  101. c = read();
  102. double m = 1;
  103. while (!isSpaceChar(c)) {
  104. if (c == 'e' || c == 'E')
  105. return res * Math.pow(10, readInt());
  106. if (c < '0' || c > '9')
  107. throw new InputMismatchException();
  108. m /= 10;
  109. res += (c - '0') * m;
  110. c = read();
  111. }
  112. }
  113. return res * sgn;
  114. }
  115. public long readLong() {
  116. int c = read();
  117. while (isSpaceChar(c))
  118. c = read();
  119. int sgn = 1;
  120. if (c == '-') {
  121. sgn = -1;
  122. c = read();
  123. }
  124. long res = 0;
  125. do {
  126. if (c < '0' || c > '9')
  127. throw new InputMismatchException();
  128. res *= 10;
  129. res += c - '0';
  130. c = read();
  131. } while (!isSpaceChar(c));
  132. return res * sgn;
  133. }
  134. public boolean isSpaceChar(int c)
  135. {
  136. if (filter != null)
  137. return filter.isSpaceChar(c);
  138. return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
  139. }
  140.  
  141. public String next()
  142. {
  143. return readString();
  144. }
  145.  
  146. public interface SpaceCharFilter
  147. {
  148. public boolean isSpaceChar(int ch);
  149. }
  150. }
  151.  
  152. private static class OutputWriter
  153. {
  154. private final PrintWriter writer;
  155.  
  156. public OutputWriter(OutputStream outputStream)
  157. {
  158. writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
  159. }
  160.  
  161. public OutputWriter(Writer writer)
  162. {
  163. this.writer = new PrintWriter(writer);
  164. }
  165. public void print(Object... objects)
  166. {
  167. for (int i = 0; i < objects.length; i++)
  168. {
  169. if (i != 0)
  170. writer.print(' ');
  171. writer.print(objects[i]);
  172. }
  173. }
  174.  
  175. public void printLine(Object... objects)
  176. {
  177. print(objects);
  178. writer.println();
  179. }
  180.  
  181. public void close()
  182. {
  183. writer.close();
  184. }
  185.  
  186. public void flush()
  187. {
  188. writer.flush();
  189. }
  190.  
  191. }
  192.  
  193. public static void main(String[] args)
  194. {
  195. InputReader input = new InputReader(System.in);
  196. OutputWriter out = new OutputWriter(System.out);
  197. int t = input.readInt();
  198. while(t-->0)
  199. {
  200. int n = input.readInt();
  201. String player = input.readString();
  202. String result ="";
  203. boolean flag = true;
  204. int a[] = new int[n];
  205. for(int i=0;i<n;i++)
  206. {
  207. a[i] = input.readInt();
  208. }
  209. if(n==1)
  210. {
  211. if(a[0]%2==0)
  212. {
  213. // System.out.println("Chef");
  214. result = "Chef";
  215. flag = false;
  216. // continue;
  217. }
  218. else
  219. {
  220. // System.out.println("Chefu");
  221. result = "Chefu";
  222. flag = false;
  223. // continue;
  224. }
  225. }
  226. if(player.trim().equals("Chef") && n%2==0)
  227. {
  228. // System.out.println("Chef");
  229. result = "Chef";
  230. flag = false;
  231. // continue;
  232. }
  233. if(flag)
  234. {
  235. int count =0;
  236. for(int i=0;i<n;i++)
  237. {
  238. if(a[i]%2==1)
  239. {
  240. ++count;
  241. ++i;
  242. }
  243. }
  244. if(count>=(n+1)/2)
  245. {
  246. // System.out.println("Chefu");
  247. result = "Chefu";
  248. }
  249. else
  250. {
  251. // System.out.println("Chef");
  252. result = "Chef";
  253. }
  254. }
  255.  
  256. System.out.println(result);
  257. }
  258. out.close();
  259. }
  260. }
Success #stdin #stdout 0.04s 4386816KB
stdin
2
1 Chef
8
3 Chef
1 2 3
stdout
Chef
Chefu