Submission #40352


ソースコード

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
43
44
45
46
47
48
49
50
51
52
53
54
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd( ll x, ll y );
ll lcm( ll x, ll y );
bool IsPrime( ll n );
int main()
{
queue<int> que;
int data;
string operation;
cin >> operation;
while ( operation != "exit" ) {
if ( operation == "push" ) {
scanf("%d", &data );
que.push(data);
} else if ( operation == "front" ) {
printf("%d\n", que.front() );
} else if ( operation == "pop" ) {
que.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;
}
bool IsPrime( ll n )
{
if ( n < 2 ) return false;
else if ( n == 2 ) return true;
else if ( n % 2 == 0 ) return false;
for ( ll i = 3; i <= sqrt( n ); i += 2 ) {
if ( n % i == 0 ) return false;
}
return true;
}

ステータス

項目 データ
問題 0601 - プログラミング入門:Queue
ユーザー名 ei1711
投稿日時 2018-07-31 15:31:40
言語 C++11
状態 Accepted
得点 1
ソースコード長 1017 Byte
最大実行時間 682 ms
最大メモリ使用量 20960 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
Input01 AC 27 ms 480 KB
1
Input02 AC 20 ms 456 KB
1
Input03 AC 16 ms 556 KB
1
Input04 AC 39 ms 656 KB
1
Input05 AC 34 ms 748 KB
1
Input06 AC 55 ms 1216 KB
1
Input07 AC 85 ms 2132 KB
1
Input08 AC 267 ms 5388 KB
1
Input09 AC 454 ms 11844 KB
1
Input10 AC 682 ms 20960 KB
1