fork download
  1. import java.io.*;
  2. import java.util.*;
  3. public class Main {
  4. public static void main(String[] args){
  5. InputStream inputStream = System.in;
  6. OutputStream outputStream = System.out;
  7. InputReader sc = new InputReader(inputStream);
  8. PrintWriter out = new PrintWriter(outputStream);
  9.  
  10. //Do your work here.
  11. //To print something use this “out.println(“Whatever”);”
  12.  
  13. int t,n,temp;
  14. t = sc.nextInt();
  15. for(int i=1; i<=t; i++) {
  16. n = sc.nextInt();
  17. String s = "";
  18. for(int j=0; j<n; j++) {
  19. temp = sc.nextInt();
  20. if(s.equals("")) {
  21. if(temp%2==0) s += "1";
  22. } else {
  23. if(temp%2==1) s += "0";
  24. else s += "1";
  25. }
  26. }
  27. out.println("Case "+i+": "+s);
  28. }
  29.  
  30. out.close();
  31. }
  32. static class InputReader {
  33. public BufferedReader reader;
  34. public StringTokenizer tokenizer;
  35.  
  36. public InputReader(InputStream stream) {
  37. reader = new BufferedReader(new InputStreamReader(stream), 32768);
  38. tokenizer = null;
  39. }
  40.  
  41. public String next() {
  42. while (tokenizer == null || !tokenizer.hasMoreTokens()) {
  43. try {
  44. tokenizer = new StringTokenizer(reader.readLine());
  45. } catch (IOException e) {
  46. throw new RuntimeException(e);
  47. }
  48. }
  49. return tokenizer.nextToken();
  50. }
  51.  
  52. public int nextInt() {
  53. return Integer.parseInt(next());
  54. }
  55.  
  56. public long nextLong() {
  57. return Long.parseLong(next());
  58. }
  59.  
  60. public String nextLine() {
  61. try {
  62. return reader.readLine();
  63. } catch (IOException e) {
  64. throw new RuntimeException(e);
  65. }
  66. }
  67.  
  68. }
  69. }
  70.  
Success #stdin #stdout 0.12s 36412KB
stdin
3
1

4
3
4 4 5
3
5 5 4
stdout
Case 1: 1
Case 2: 110
Case 3: 1