Submission #19205


ソースコード

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
#include<cstdio>
#include<iostream>
#include<stack>
#include<string>
#include<vector>
using namespace std;
int main(){
vector<int> ans;
stack<int> st;
string str;
while(true){
cin>>str;
if(str=="exit")break;
else if(str=="push"){
int n;
scanf("%d",&n);
st.push(n);
}else if(str=="pop"){
st.pop();
}else if(str=="top"){
ans.push_back(st.top());
}
}
for(int i=0;i<ans.size();++i){
printf("%d\n",ans[i]);
}
}

ステータス

項目 データ
問題 0600 - プログラミング入門:Stack
ユーザー名 Arumakan_ei1727
投稿日時 2017-06-09 17:45:26
言語 C++17
状態 Accepted
得点 1
ソースコード長 511 Byte
最大実行時間 257 ms
最大メモリ使用量 5044 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
Input01 AC 11 ms 480 KB
1
Input02 AC 13 ms 712 KB
1
Input03 AC 11 ms 560 KB
1
Input04 AC 11 ms 528 KB
1
Input05 AC 13 ms 612 KB
1
Input06 AC 23 ms 804 KB
1
Input07 AC 36 ms 1016 KB
1
Input08 AC 82 ms 1720 KB
1
Input09 AC 170 ms 3244 KB
1
Input10 AC 257 ms 5044 KB
1