結果

問題 No.3043 yukicoderへようこそ!
ユーザー ugis_progugis_prog
提出日時 2019-04-01 23:24:13
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 879 bytes
コンパイル時間 1,228 ms
コンパイル使用メモリ 148,920 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-18 02:34:09
合計ジャッジ時間 1,722 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using s=string;

random_device rnd;
mt19937 mt(rnd());
uniform_int_distribution<> r(0, 4);

void sum(){
    int N;
    cin >> N;
    long long Sum = 0;
    for(int i=0;i<N;i++){
        long long a;
        cin >> a;
        Sum += a;
    }

    cout << Sum << endl;
}

void FizzBuzz(){
    int A,B;
    string S;
    cin >> A >> B >> S;
    int p = r(mt);
    if(p == 0) cout << "Hello World!" << endl;
    else if(p == 1) cout << A*(A+1)/2 << endl;
    else if(p == 2) cout << A+B << " " << S << endl;
    else {
        for(int i=1;i<=A;i++){
            if(i%15 == 0) cout << "FizzBuzz\n";
            else if(i%5 == 0) cout << "Buzz\n";
            else if(i%3 == 0) cout << "Fizz\n";
            else cout << to_string(i) + '\n';  
        }
    }
}


int main(){
    int p = r(mt);

    if(p < 2) sum();
    else FizzBuzz();
}
0