Submission #15528


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import java.util.ArrayDeque;
import java.util.Scanner;
import java.util.function.LongSupplier;
public class Main{
static final Scanner s=new Scanner(System.in);
static final long[] fal_rnd(long[] ar,LongSupplier sp){
int l=-1,r=ar.length;
while(l+1!=r)
ar[Math.random()<0.5?++l:--r]=sp.getAsLong();
return ar;
}
public static void main(String[] __){
ArrayDeque<Integer> deque=new ArrayDeque<>();
StringBuilder sb = new StringBuilder();
while(true){
switch(s.next()){
case "push":
deque.add(Integer.parseInt(s.next()));
break;
case "top":
sb.append(deque.peekLast()+"\n");
break;
case "pop":
deque.pollLast();
break;
case "exit":
System.out.print(sb.toString());
return;
}
}
}
}

ステータス

項目 データ
問題 0600 - プログラミング入門:Stack
ユーザー名 fal_rnd
投稿日時 2017-04-26 00:05:46
言語 Java
状態 Accepted
得点 1
ソースコード長 793 Byte
最大実行時間 928 ms
最大メモリ使用量 114768 KB

セット

セット 得点 Cases
1 ALL 1 / 1 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
Input01 AC 68 ms 14380 KB
1
Input02 AC 67 ms 13492 KB
1
Input03 AC 71 ms 14812 KB
1
Input04 AC 71 ms 16712 KB
1
Input05 AC 92 ms 18552 KB
1
Input06 AC 131 ms 32492 KB
1
Input07 AC 171 ms 49152 KB
1
Input08 AC 344 ms 82204 KB
1
Input09 AC 652 ms 106708 KB
1
Input10 AC 928 ms 114768 KB
1