Submission #40111


ソースコード

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
37
38
39
40
41
42
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd( ll x, ll y );
ll lcm( ll x, ll y );
int main()
{
stack<int> st;
int data;
string operation;
cin >> operation;
while ( operation != "exit") {
if ( operation == "push" ) {
scanf("%d", &data );
st.push( data );
} else if ( operation == "top" ) {
printf("%d\n", st.top() );
} else if ( operation == "pop" ) {
st.pop();
}
cin >> operation;
}
return 0;
}
ll gcd( ll x, ll y )
{
if ( y == 0 ) return x;
return gcd( y, x % y );
}
ll lcm( ll x, ll y )
{
return x / gcd( x, y ) * y;
}

ステータス

項目 データ
問題 0600 - プログラミング入門:Stack
ユーザー名 ei1711
投稿日時 2018-07-29 19:51:38
言語 C++11
状態 Accepted
得点 1
ソースコード長 732 Byte
最大実行時間 665 ms
最大メモリ使用量 4144 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
Input01 AC 23 ms 480 KB
1
Input02 AC 28 ms 456 KB
1
Input03 AC 20 ms 564 KB
1
Input04 AC 28 ms 532 KB
1
Input05 AC 31 ms 500 KB
1
Input06 AC 54 ms 716 KB
1
Input07 AC 83 ms 860 KB
1
Input08 AC 217 ms 1564 KB
1
Input09 AC 462 ms 2572 KB
1
Input10 AC 665 ms 4144 KB
1