Submission #40469


ソースコード

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
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
int dx[]={1,0,-1,0};
int dy[]={0,-1,0,1};
int dxx[]={1,1,0,-1,-1,-1,0,1};
int dyy[]={0,-1,-1,-1,0,1,1,1};
bool inside(int x,int y,int w,int h){
return (x>=0 && y>=0 && x<w && y<h);}
typedef long long ll;
typedef pair<int,int> pii;
int main(){
cin.tie(0), ios::sync_with_stdio(false);
int a;
stack<int> hoge;
string str;
while(cin>>str,str!="exit"){
if(str=="push"){
cin >>a;
hoge.push(a);
}
if(str=="top") cout<< hoge.top()<<endl;
if(str=="pop") hoge.pop();
}
return 0;
}

ステータス

項目 データ
問題 0600 - プログラミング入門:Stack
ユーザー名 ei1821
投稿日時 2018-08-03 09:22:08
言語 C++11
状態 Accepted
得点 1
ソースコード長 722 Byte
最大実行時間 505 ms
最大メモリ使用量 19976 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
Input01 AC 50 ms 480 KB
1
Input02 AC 22 ms 692 KB
1
Input03 AC 26 ms 656 KB
1
Input04 AC 51 ms 604 KB
1
Input05 AC 38 ms 552 KB
1
Input06 AC 52 ms 1260 KB
1
Input07 AC 75 ms 2160 KB
1
Input08 AC 171 ms 4768 KB
1
Input09 AC 397 ms 11008 KB
1
Input10 AC 505 ms 19976 KB
1