Advertisement
Guest User

Untitled

a guest
Oct 16th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. import java.io.BufferedReader;
  2. import java.io.InputStreamReader;
  3. import java.io.InputStream;
  4. import java.nio.CharBuffer;
  5. import java.io.IOException;
  6. import java.io.UnsupportedEncodingException;
  7. import java.lang.StringBuilder;
  8. import java.lang.String;
  9. import java.io.*;
  10.  
  11. public class FastScanner {
  12. private InputStreamReader in;
  13. private String buffer;
  14. private int readerPtr;
  15.  
  16. public FastScanner(InputStream stream, String enccoding) throws UnsupportedEncodingException {
  17. in = new InputStreamReader(stream, enccoding);
  18. buffer = "";
  19. readerPtr = 0;
  20. }
  21.  
  22. public void fflush() {
  23. buffer = "";
  24. readerPtr = 0;
  25. }
  26. public boolean hasNextInt()
  27. {
  28. if (readerPtr != buffer.length())
  29. return true;
  30. fflush();
  31. char a = 'a';
  32. boolean flag = false;
  33. while (!Character.isWhitespace(a))
  34. {
  35. try
  36. {
  37. a = (char)in.read();
  38. if (Character.isWhitespace(a))
  39. if (flag)
  40. return true;
  41. else
  42. return false;
  43. buffer += a;
  44. flag = true;
  45. } catch (IOException e)
  46. {
  47. e.printStackTrace();
  48. return false;
  49. }
  50. }
  51. return true;
  52. }
  53. public int nextInt()
  54. {
  55. return Integer.parseInt(buffer);
  56. }
  57. /*public boolean hasNextLine() throws IOException {
  58. return hasNext();
  59. }
  60.  
  61. public String nextLine() throws IOException {
  62. StringBuilder result = new StringBuilder("");
  63. while (hasNext()) {
  64. char ch = next();
  65. if (ch == '\n')
  66. break;
  67. result.append(ch);
  68. }
  69. return result.toString();
  70. }
  71.  
  72. public void close() {
  73. try {
  74. in.close();
  75. } catch (IOException e) {
  76. System.err.println("Scanner is not closed");
  77. }
  78. }*/
  79. }
  80.  
  81. public class Main
  82. {
  83. public static void main(String[] args) {
  84. FastScanner fs = new FastScanner(System.in,"KOI8-R");
  85. while (fs.hasNextInt())
  86. System.out.println(fs.nextInt() * 10);
  87. }
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement