Guest User

Untitled

a guest
Jan 20th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.60 KB | None | 0 0
  1. import java.io.Writer;
  2. import java.io.BufferedWriter;
  3. import java.io.OutputStreamWriter;
  4. import java.io.OutputStream;
  5. import java.io.PrintWriter;
  6. import java.io.IOException;
  7. import java.io.InputStream;
  8. import java.math.BigInteger;
  9. import java.util.Arrays;
  10. import java.util.InputMismatchException;
  11.  
  12. /**
  13. * Built using CHelper plug-in
  14. * Actual solution is at the top
  15. */
  16. public class Main {
  17. public static void main(String[] args) {
  18. InputStream inputStream = System.in;
  19. OutputStream outputStream = System.out;
  20. InputReader in = new InputReader(inputStream);
  21. OutputWriter out = new OutputWriter(outputStream);
  22. MINEAT solver = new MINEAT();
  23. solver.solve(1, in, out);
  24. out.close();
  25. }
  26.  
  27. static class MINEAT {
  28. public void solve(int testNumber, InputReader in, OutputWriter out) {
  29.  
  30. }
  31.  
  32. }
  33.  
  34. static class OutputWriter {
  35. private final PrintWriter writer;
  36.  
  37. public OutputWriter(OutputStream outputStream) {
  38. writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
  39. }
  40.  
  41. public OutputWriter(Writer writer) {
  42. this.writer = new PrintWriter(writer);
  43. }
  44.  
  45. public void print(char[] array) {
  46. writer.print(array);
  47. }
  48.  
  49. public void print(Object... objects) {
  50. for (int i = 0; i < objects.length; i++) {
  51. if (i != 0) {
  52. writer.print(' ');
  53. }
  54. writer.print(objects[i]);
  55. }
  56. }
  57.  
  58. public void print(int[] array) {
  59. for (int i = 0; i < array.length; i++) {
  60. if (i != 0) {
  61. writer.print(' ');
  62. }
  63. writer.print(array[i]);
  64. }
  65. }
  66.  
  67. public void print(double[] array) {
  68. for (int i = 0; i < array.length; i++) {
  69. if (i != 0) {
  70. writer.print(' ');
  71. }
  72. writer.print(array[i]);
  73. }
  74. }
  75.  
  76. public void print(long[] array) {
  77. for (int i = 0; i < array.length; i++) {
  78. if (i != 0) {
  79. writer.print(' ');
  80. }
  81. writer.print(array[i]);
  82. }
  83. }
  84.  
  85. public void println(int[] array) {
  86. print(array);
  87. writer.println();
  88. }
  89.  
  90. public void println(double[] array) {
  91. print(array);
  92. writer.println();
  93. }
  94.  
  95. public void println(long[] array) {
  96. print(array);
  97. writer.println();
  98. }
  99.  
  100. public void print(int[][] matrix) {
  101. for(int i = 0;i<matrix.length;i++){
  102. for (int j = 0; j < matrix[i].length; j++) {
  103. if (j != 0) {
  104. writer.print(' ');
  105. }
  106. writer.print(matrix[i][j]);
  107. }
  108. writer.println();
  109. }
  110. }
  111.  
  112. public void print(char[][] matrix) {
  113. for(int i = 0;i<matrix.length;i++){
  114. for (int j = 0; j < matrix[i].length; j++) {
  115. if (j != 0) {
  116. writer.print(' ');
  117. }
  118. writer.print(matrix[i][j]);
  119. }
  120. writer.println();
  121. }
  122. }
  123.  
  124. public void println() {
  125. writer.println();
  126. }
  127.  
  128. public void println(Object... objects) {
  129. print(objects);
  130. writer.println();
  131. }
  132.  
  133. public void print(char i) {
  134. writer.print(i);
  135. }
  136.  
  137. public void println(char i) {
  138. writer.println(i);
  139. }
  140.  
  141. public void println(char[] array) {
  142. writer.println(array);
  143. }
  144.  
  145. public void printf(String format, Object... objects) {
  146. writer.printf(format, objects);
  147. }
  148.  
  149. public void close() {
  150. writer.close();
  151. }
  152.  
  153. public void flush() {
  154. writer.flush();
  155. }
  156.  
  157. public void print(long i) {
  158. writer.print(i);
  159. }
  160.  
  161. public void println(long i) {
  162. writer.println(i);
  163. }
  164.  
  165. public void print(int i) {
  166. writer.print(i);
  167. }
  168.  
  169. public void println(int i) {
  170. writer.println(i);
  171. }
  172.  
  173. public void separateLines(int[] array) {
  174. for (int i : array) {
  175. println(i);
  176. }
  177. }
  178. }
  179.  
  180. static class InputReader {
  181. private boolean finished = false;
  182.  
  183. private InputStream stream;
  184. private byte[] buf = new byte[1024];
  185. private int curChar;
  186. private int numChars;
  187. private SpaceCharFilter filter;
  188.  
  189. public InputReader(InputStream stream) {
  190. this.stream = stream;
  191. }
  192.  
  193. public int read() {
  194. if (numChars == -1) {
  195. throw new InputMismatchException();
  196. }
  197. if (curChar >= numChars) {
  198. curChar = 0;
  199. try {
  200. numChars = stream.read(buf);
  201. } catch (IOException e) {
  202. throw new InputMismatchException();
  203. }
  204. if (numChars <= 0) {
  205. return -1;
  206. }
  207. }
  208. return buf[curChar++];
  209. }
  210.  
  211. public int peek() {
  212. if (numChars == -1) {
  213. return -1;
  214. }
  215. if (curChar >= numChars) {
  216. curChar = 0;
  217. try {
  218. numChars = stream.read(buf);
  219. } catch (IOException e) {
  220. return -1;
  221. }
  222. if (numChars <= 0) {
  223. return -1;
  224. }
  225. }
  226. return buf[curChar];
  227. }
  228.  
  229. public int nextInt() {
  230. int c = read();
  231. while (isSpaceChar(c)) {
  232. c = read();
  233. }
  234. int sgn = 1;
  235. if (c == '-') {
  236. sgn = -1;
  237. c = read();
  238. }
  239. int res = 0;
  240. do {
  241. if (c < '0' || c > '9') {
  242. throw new InputMismatchException();
  243. }
  244. res *= 10;
  245. res += c - '0';
  246. c = read();
  247. } while (!isSpaceChar(c));
  248. return res * sgn;
  249. }
  250.  
  251. public long nextLong() {
  252. int c = read();
  253. while (isSpaceChar(c)) {
  254. c = read();
  255. }
  256. int sgn = 1;
  257. if (c == '-') {
  258. sgn = -1;
  259. c = read();
  260. }
  261. long res = 0;
  262. do {
  263. if (c < '0' || c > '9') {
  264. throw new InputMismatchException();
  265. }
  266. res *= 10;
  267. res += c - '0';
  268. c = read();
  269. } while (!isSpaceChar(c));
  270. return res * sgn;
  271. }
  272.  
  273. public String nextString() {
  274. int c = read();
  275. while (isSpaceChar(c)) {
  276. c = read();
  277. }
  278. StringBuilder res = new StringBuilder();
  279. do {
  280. if (Character.isValidCodePoint(c)) {
  281. res.appendCodePoint(c);
  282. }
  283. c = read();
  284. } while (!isSpaceChar(c));
  285. return res.toString();
  286. }
  287.  
  288. public boolean isSpaceChar(int c) {
  289. if (filter != null) {
  290. return filter.isSpaceChar(c);
  291. }
  292. return isWhitespace(c);
  293. }
  294.  
  295. public static boolean isWhitespace(int c) {
  296. return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
  297. }
  298.  
  299. private String readLine0() {
  300. StringBuilder buf = new StringBuilder();
  301. int c = read();
  302. while (c != '\n' && c != -1) {
  303. if (c != '\r') {
  304. buf.appendCodePoint(c);
  305. }
  306. c = read();
  307. }
  308. return buf.toString();
  309. }
  310.  
  311. public String readLine() {
  312. String s = readLine0();
  313. while (s.trim().length() == 0) {
  314. s = readLine0();
  315. }
  316. return s;
  317. }
  318.  
  319. public String readLine(boolean ignoreEmptyLines) {
  320. if (ignoreEmptyLines) {
  321. return readLine();
  322. } else {
  323. return readLine0();
  324. }
  325. }
  326.  
  327. public BigInteger readBigInteger() {
  328. try {
  329. return new BigInteger(nextString());
  330. } catch (NumberFormatException e) {
  331. throw new InputMismatchException();
  332. }
  333. }
  334.  
  335. public char nextCharacter() {
  336. int c = read();
  337. while (isSpaceChar(c)) {
  338. c = read();
  339. }
  340. return (char) c;
  341. }
  342.  
  343. public double nextDouble() {
  344. int c = read();
  345. while (isSpaceChar(c)) {
  346. c = read();
  347. }
  348. int sgn = 1;
  349. if (c == '-') {
  350. sgn = -1;
  351. c = read();
  352. }
  353. double res = 0;
  354. while (!isSpaceChar(c) && c != '.') {
  355. if (c == 'e' || c == 'E') {
  356. return res * Math.pow(10, nextInt());
  357. }
  358. if (c < '0' || c > '9') {
  359. throw new InputMismatchException();
  360. }
  361. res *= 10;
  362. res += c - '0';
  363. c = read();
  364. }
  365. if (c == '.') {
  366. c = read();
  367. double m = 1;
  368. while (!isSpaceChar(c)) {
  369. if (c == 'e' || c == 'E') {
  370. return res * Math.pow(10, nextInt());
  371. }
  372. if (c < '0' || c > '9') {
  373. throw new InputMismatchException();
  374. }
  375. m /= 10;
  376. res += (c - '0') * m;
  377. c = read();
  378. }
  379. }
  380. return res * sgn;
  381. }
  382.  
  383. public boolean isExhausted() {
  384. int value;
  385. while (isSpaceChar(value = peek()) && value != -1) {
  386. read();
  387. }
  388. return value == -1;
  389. }
  390.  
  391. public String next() {
  392. return nextString();
  393. }
  394.  
  395. public SpaceCharFilter getFilter() {
  396. return filter;
  397. }
  398.  
  399. public void setFilter(SpaceCharFilter filter) {
  400. this.filter = filter;
  401. }
  402.  
  403. public interface SpaceCharFilter {
  404. public boolean isSpaceChar(int ch);
  405. }
  406. public int[] nextIntArray(int n){
  407. int[] array=new int[n];
  408. for(int i=0;i<n;++i)array[i]=nextInt();
  409. return array;
  410. }
  411. public int[] nextSortedIntArray(int n){
  412. int array[]=nextIntArray(n);
  413. Arrays.sort(array);
  414. return array;
  415. }
  416. public int[] nextSumIntArray(int n){
  417. int[] array=new int[n];
  418. array[0]=nextInt();
  419. for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();
  420. return array;
  421. }
  422. public long[] nextLongArray(int n){
  423. long[] array=new long[n];
  424. for(int i=0;i<n;++i)array[i]=nextLong();
  425. return array;
  426. }
  427. public long[] nextSumLongArray(int n){
  428. long[] array=new long[n];
  429. array[0]=nextInt();
  430. for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();
  431. return array;
  432. }
  433. public long[] nextSortedLongArray(int n){
  434. long array[]=nextLongArray(n);
  435. Arrays.sort(array);
  436. return array;
  437. }
  438. }
  439. }
Add Comment
Please, Sign In to add comment