fork download
  1. import java.util.*;
  2. import java.io.*;
  3. class test
  4. {
  5. public static void main(String[] args) throws IOException
  6. {
  7.  
  8.  
  9.  
  10. String input[]=br.readLine().split(" ");
  11.  
  12. int N=Integer.parseInt(input[0]);
  13. int k=Integer.parseInt(input[1]);
  14. int L=Integer.parseInt(input[2]);
  15. int Q=Integer.parseInt(input[3]);
  16.  
  17. String name=new String[N];
  18.  
  19. Map ques = new HashMap();
  20. for(int i=0;i<N;i++)
  21. {
  22.  
  23.  
  24. String temp="";
  25. String inputs[]=br.readLine().split(" ");
  26. name=inputs[0];
  27. if(k<2)
  28. temp+=inputs[1];
  29. else if(k<3)
  30. temp+=inputs[1]+inputs[2];
  31. else if(k<4)
  32. temp+=inputs[1]+inputs[2]+inputs[3];
  33. else if(k<5)
  34. temp+=inputs[1]+inputs[2]+inputs[3]+inputs[4];
  35. else if(k<6)
  36. temp+=inputs[1]+inputs[2]+inputs[3]+inputs[4]+inputs[5];
  37.  
  38. ques.put(Integer.parseInt(temp),name);
  39. }
  40.  
  41. for(int j=0;j<Q;j++)
  42. {String temps="";
  43. String inputs[]=br.readLine().split(" ");
  44. if(k<2)
  45. temps+=inputs[0];
  46. else if(k<3)
  47. temps+=inputs[0]+inputs[1];
  48. else if(k<4)
  49. temps+=inputs[0]+inputs[1]+inputs[2];
  50. else if(k<5)
  51. temps+=inputs[0]+inputs[1]+inputs[2]+inputs[3];
  52. else if(k<6)
  53. temps+=inputs[0]+inputs[1]+inputs[2]+inputs[3]+inputs[4];
  54.  
  55. int number=Integer.parseInt(temps);
  56.  
  57.  
  58. if(ques.get(number))
  59. System.out.println(ques.get(number));
  60. else
  61. System.out.println("You cant fool me :P");
  62.  
  63.  
  64.  
  65. }
  66. }
  67.  
  68. }
  69.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
5 3 9 5
baryonyx 5 1 7
jobaria 1 2 3
oviraptor 9 7 1
troodon 6 9 5
minmi 7 4 5
9 7 1
1 2 3
5 8 8
1 2 3
7 4 5
compilation info
Main.java:19: error: incompatible types
		String  name=new String[N];
		             ^
  required: String
  found:    String[]
Main.java:60: error: incompatible types
			if(ques.get(number))
			           ^
  required: boolean
  found:    Object
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
stdout
Standard output is empty