Advertisement
AdelKhalilov

Untitled

Jan 23rd, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.64 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.Locale;
  3. import java.util.StringTokenizer;
  4.  
  5.  
  6. public class E {
  7. String filename = "addition";//filename here, System.in/out if no file
  8.  
  9. FastScanner in;
  10. PrintWriter out;
  11. int n;
  12. int k;
  13. int a;
  14. int b;
  15. int[] x;
  16.  
  17. void solve() {
  18. //your code here
  19. n = in.nextInt();
  20. k = in.nextInt();
  21. a = in.nextInt();
  22. b = in.nextInt();
  23. x = new int[n];
  24. for (int i = 0; i < n; i++) {
  25. x[i] = in.nextInt();
  26. }
  27.  
  28. }
  29.  
  30. void run() throws IOException {
  31. InputStream input = System.in;
  32. OutputStream output = System.out;
  33. /* try {
  34. File f = new File(filename + ".in");
  35. if (f.exists() && f.canRead()) {
  36. input = new FileInputStream(f);
  37. output = new FileOutputStream(filename + ".out");
  38. }
  39. } catch (IOException e) {
  40. }*/
  41. in = new FastScanner(input);
  42. out = new PrintWriter(new BufferedOutputStream(output));
  43. solve();
  44. in.close();
  45. out.close();
  46. }
  47.  
  48. public static void main(String[] args) throws IOException {
  49. Locale.setDefault(Locale.US);
  50. new E().run();
  51. }
  52.  
  53. class FastScanner implements Closeable {
  54. private BufferedReader br;
  55. private StringTokenizer tokenizer;
  56.  
  57. public FastScanner(InputStream stream) throws FileNotFoundException {
  58. br = new BufferedReader(new InputStreamReader(stream));
  59. }
  60.  
  61. public String next() {
  62. while (tokenizer == null || !tokenizer.hasMoreTokens()) {
  63. try {
  64. tokenizer = new StringTokenizer(br.readLine());
  65. } catch (IOException e) {
  66. throw new RuntimeException(e);
  67. }
  68. }
  69. return tokenizer.nextToken();
  70. }
  71.  
  72. public String nextLine() {
  73. if (tokenizer == null || !tokenizer.hasMoreTokens()) {
  74. try {
  75. return br.readLine();
  76. } catch (IOException e) {
  77. throw new RuntimeException(e);
  78. }
  79. }
  80. return tokenizer.nextToken("\n");
  81. }
  82.  
  83. public int nextInt() {
  84. return Integer.parseInt(next());
  85. }
  86.  
  87. public long nextLong() {
  88. return Long.parseLong(next());
  89. }
  90.  
  91. public double nextDouble() {
  92. return Double.parseDouble(next());
  93. }
  94.  
  95. @Override
  96. public void close() throws IOException {
  97. br.close();
  98. }
  99. }
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement