fork(3) download
  1. /**
  2.  *
  3.  * @author safeallah ramezanzadeh
  4.  */
  5.  
  6. public class Main{
  7. byte[] buf = new byte[81920];
  8. int index=0;
  9. int readed=0;
  10.  
  11.  
  12. public Main(){
  13.  
  14. }
  15.  
  16. private byte readByte(){
  17. byte x;
  18. if(index==readed){
  19. index=0;
  20.  
  21. try{
  22. readed=System.in.read(buf,0,81920);
  23. }catch(Exception e){}
  24. }
  25. x=buf[index];
  26. index++;
  27. return x;
  28. }
  29.  
  30.  
  31.  
  32. public int readInt(){
  33. int r=0;
  34. int sign=1;
  35. byte c;
  36. while(true){
  37. c=readByte();
  38. if(c=='-'){
  39. sign=-1;
  40. break;
  41. }else if((c>='0' && c<='9')){
  42. r=(c-'0');
  43. break;
  44. }
  45.  
  46. }
  47. while(true){
  48. c=readByte();
  49. if(c=='\n' || c==' ')
  50. break;
  51. r=r*10+(c-'0');
  52. }
  53. return sign*r;
  54. }
  55.  
  56.  
  57.  
  58. public static void main(String args[]){
  59. Main t=new Main();
  60. int x=t.readInt();
  61. while(x!=-1){
  62. System.out.println(x);
  63. x=t.readInt();
  64.  
  65. }
  66. }
  67.  
  68. }
  69.  
Success #stdin #stdout 0.02s 245760KB
stdin
12
13
-4
15
-891
18
-1
2
4
5
stdout
12
13
-4
15
-891
18