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. int num[]=new int[N];
  19.  
  20. for(int i=0;i<N;i++)
  21. {
  22. String temp="";
  23. String inputs[]=br.readLine().split(" ");
  24. name[i]=inputs[0];
  25. if(k<2)
  26. temp+=inputs[1];
  27. else if(k<3)
  28. temp+=inputs[1]+inputs[2];
  29. else if(k<4)
  30. temp+=inputs[1]+inputs[2]+inputs[3];
  31. else if(k<5)
  32. temp+=inputs[1]+inputs[2]+inputs[3]+inputs[4];
  33. else if(k<6)
  34. temp+=inputs[1]+inputs[2]+inputs[3]+inputs[4]+inputs[5];
  35.  
  36. num[i]=Integer.parseInt(temp);
  37. }
  38.  
  39. for(int j=0;j<k;j++)
  40. {
  41. String temps="";
  42. String inputs[]=br.readLine().split(" ");
  43. if(k<2)
  44. temps+=inputs[0];
  45. else if(k<3)
  46. temps+=inputs[0]+inputs[1];
  47. else if(k<4)
  48. temps+=inputs[0]+inputs[1]+inputs[2];
  49. else if(k<5)
  50. temps+=inputs[0]+inputs[1]+inputs[2]+inputs[3];
  51. else if(k<6)
  52. temps+=inputs[0]+inputs[1]+inputs[2]+inputs[3]+inputs[4];
  53.  
  54. int number=Integer.parseInt(temps);
  55.  
  56. for(int i=0;i<N;i++)
  57. {
  58. if(number==num[i])
  59. {
  60. System.out.println(name[i]);
  61. break;
  62. }
  63.  
  64.  
  65. if(i==N-1 && number==num[i])
  66. System.out.println("You cant fool me :P");
  67. }
  68.  
  69. }
  70. }
  71.  
  72. }
  73.  
Runtime error #stdin #stdout #stderr 0.07s 380160KB
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
stdout
Standard output is empty
stderr
Exception in thread "main" java.lang.NumberFormatException: For input string: "517123971695"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:495)
	at java.lang.Integer.parseInt(Integer.java:527)
	at test.main(Main.java:37)