Submission #131780
Source Code Expand
import java.io.IOException; import java.io.InputStream; import java.util.Collections; import java.util.InputMismatchException; import java.util.LinkedList; public class Main { // Scanner in = new Scanner(System.in); public static void main(String[] args){ new Main(); } public Main(){ // new problem_B(); new Atcoder_A(); } class Atcoder_A{ public Atcoder_A() { java.util.Scanner in = new java.util.Scanner(System.in); int n = in.nextInt(); System.out.println(n*2); } } class problem_B{ public problem_B() { Scanner in = new Scanner(System.in); int n = in.nextInt(); LinkedList<Integer> list = new LinkedList<Integer>(); LinkedList<Integer> list2 = new LinkedList<Integer>(); for(int i=0;i<n;i++){ int input = in.nextInt(); if(!list.contains(input))list.add(input); else if(!list2.contains(input))list2.push(input); } Collections.sort(list);Collections.sort(list2); if(list2.size()>0&&list.get(list.size()-1)==list2.get(list2.size()-1))list2.remove(list2.size()-1); //print System.out.println(list.size()+list2.size()); for(int i=0;i<list.size()-1;i++)System.out.print(list.get(i)+" "); System.out.print(list.get(list.size()-1)); if(list2.size()>0){ System.out.print(" "); for(int i=list2.size()-1;i>0;i--)System.out.print(list2.get(i)+" "); System.out.print(list2.get(0)); } System.out.println(); } class Scanner { InputStream in; byte[] buf = new byte[1 << 10]; int p, n; boolean[] isSpace = new boolean[128]; Scanner(InputStream in) { this.in = in; isSpace[' '] = isSpace['\n'] = isSpace['\r'] = isSpace['\t'] = true; } int read() { if (n == -1) return -1; if (p >= n) { p = 0; try { n = in.read(buf); } catch (IOException e) { throw new RuntimeException(e); } if (n <= 0) return -1; } return buf[p++]; } boolean hasNext() { int c = read(); while (c >= 0 && isSpace[c]) c = read(); if (c == -1) return false; p--; return true; } String next() { if (!hasNext()) throw new InputMismatchException(); StringBuilder sb = new StringBuilder(); int c = read(); while (c >= 0 && !isSpace[c]) { sb.append((char)c); c = read(); } return sb.toString(); } int nextInt() { if (!hasNext()) throw new InputMismatchException(); int c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } int res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } while (c >= 0 && !isSpace[c]); return res * sgn; } long nextLong() { if (!hasNext()) throw new InputMismatchException(); int c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } long res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } while (c >= 0 && !isSpace[c]); return res * sgn; } double nextDouble() { return Double.parseDouble(next()); } } } // class problem_A{ // public problem_A() { // int n = in.nextInt(); // ArrayList<Integer> list = new ArrayList<Integer>(); // for(int i=0;i<n;i++)list.add(in.nextInt()); // int sereja=0,dima=0,num=0; // for(int i=0;list.size()>0;i++){ // if(list.get(0)>list.get(list.size()-1))num=list.remove(0); // else num=list.remove(list.size()-1); // if(i%2==0)sereja+=num; // else dima+=num; // } // System.out.println(sereja+" "+dima); // } // } }
Submission Info
Submission Time | |
---|---|
Task | A - 流行 |
User | ne240214 |
Language | Java (OpenJDK 1.7.0) |
Score | 100 |
Code Size | 4631 Byte |
Status | AC |
Exec Time | 534 ms |
Memory | 23240 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | 00_sample_00.txt, max_1000000.txt, min_0.txt, rand_133007.txt, rand_171937.txt, rand_172717.txt, rand_232508.txt, rand_242450.txt, rand_246841.txt, rand_269046.txt, rand_320433.txt, rand_435534.txt, rand_50616.txt, rand_537196.txt, rand_565439.txt, rand_601980.txt, rand_622146.txt, rand_624081.txt, rand_678601.txt, rand_696476.txt, rand_762274.txt, rand_798714.txt, rand_821336.txt, rand_85323.txt, rand_859632.txt, rand_921203.txt, rand_934508.txt, rand_993594.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_00.txt | AC | 534 ms | 23240 KB |
max_1000000.txt | AC | 476 ms | 23084 KB |
min_0.txt | AC | 466 ms | 23160 KB |
rand_133007.txt | AC | 475 ms | 23088 KB |
rand_171937.txt | AC | 477 ms | 23084 KB |
rand_172717.txt | AC | 486 ms | 23160 KB |
rand_232508.txt | AC | 483 ms | 23084 KB |
rand_242450.txt | AC | 469 ms | 23084 KB |
rand_246841.txt | AC | 481 ms | 23212 KB |
rand_269046.txt | AC | 476 ms | 23084 KB |
rand_320433.txt | AC | 482 ms | 23220 KB |
rand_435534.txt | AC | 478 ms | 23088 KB |
rand_50616.txt | AC | 477 ms | 23160 KB |
rand_537196.txt | AC | 483 ms | 23100 KB |
rand_565439.txt | AC | 477 ms | 23232 KB |
rand_601980.txt | AC | 476 ms | 23084 KB |
rand_622146.txt | AC | 481 ms | 22956 KB |
rand_624081.txt | AC | 474 ms | 23088 KB |
rand_678601.txt | AC | 472 ms | 23216 KB |
rand_696476.txt | AC | 473 ms | 23124 KB |
rand_762274.txt | AC | 463 ms | 23212 KB |
rand_798714.txt | AC | 509 ms | 23084 KB |
rand_821336.txt | AC | 482 ms | 23020 KB |
rand_85323.txt | AC | 474 ms | 23216 KB |
rand_859632.txt | AC | 482 ms | 23208 KB |
rand_921203.txt | AC | 464 ms | 23092 KB |
rand_934508.txt | AC | 477 ms | 23212 KB |
rand_993594.txt | AC | 467 ms | 23092 KB |