Submission #00175


ソースコード

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
#include<bits/stdc++.h>
#define np(v) next_permutation(v.begin(),v.end()) //次の順列
#define gcd(a,b) __gcd(a,b) //最大公約数
#define lcm(a,b) a/(gcd(a,b))*b //最小公倍数
#define lb(v,a) lower_bound(v.begin(),v.end(),a) //以上の最初
#define ub(v,a) upper_bound(v.begin(),v.end(),a) //越えの最初
#define bs(v,a) binary_search(v.begin(),v.end(),a) //値があるか
#define fixed(a) fixed<<setprecision(a) //小数点以下第 a + 1 を四捨五入
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<ll,int>;
using pq = priority_queue<P,vector<P>,greater<P>>;
const int inf = 1 << 30;
const ll ll_inf = 1LL << 62;
struct edge {
int c,to;
};
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
srand((unsigned int)time(NULL));
int N,a,b;
cin>>N>>a>>b;
for(int i = 1;i <= N;i++){
string s = "";
if(a != 0 && i%a == 0){
s += "Fizz";
}
if(b != 0 && i%b == 0){
s += "Buzz";
}
if(s == ""){
cout<<i<<"\n";
}else{
cout<<s<<"\n";
}
}
}

ステータス

項目 データ
問題 0012 - Extension FizzBuzz
ユーザー名 r2213
投稿日時 2024-04-26 16:19:00
言語 C++17
状態 Accepted
得点 11
ソースコード長 1180 Byte
最大実行時間 107 ms
最大メモリ使用量 30032 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in01 AC 19 ms 472 KB
1
in02 AC 19 ms 428 KB
1
in03 AC 21 ms 380 KB
1
in04 AC 19 ms 464 KB
1
in05 AC 18 ms 416 KB
1
in06 AC 18 ms 496 KB
1
in07 AC 16 ms 580 KB
1
in08 AC 20 ms 660 KB
1
in09 AC 22 ms 740 KB
1
in10 AC 17 ms 564 KB
1
in11 AC 22 ms 1164 KB
1
in12 AC 48 ms 4316 KB
1
in13 AC 64 ms 8872 KB
1
in14 AC 43 ms 11124 KB
1
in15 AC 30 ms 12100 KB
1
in16 AC 51 ms 15636 KB
1
in17 AC 107 ms 21220 KB
1
in18 AC 58 ms 25776 KB
1
in19 AC 31 ms 27132 KB
1
in20 AC 41 ms 30032 KB
1