結果

問題 No.3043 yukicoderへようこそ!
ユーザー ugis_progugis_prog
提出日時 2019-04-01 23:35:40
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 890 bytes
コンパイル時間 1,278 ms
コンパイル使用メモリ 148,712 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-18 02:49:56
合計ジャッジ時間 2,445 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int FizzBuzz()’:
main.cpp:37:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^

ソースコード

diff #

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

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

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

    cout << Sum << endl;
}

int FizzBuzz(){
    int B;
    string S;
    cin >> B >> S;
    int p = r(mt);
    if(S == "yukicoder") cout << "Hello World!" << endl;
    else if(p == 0) 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);
    cin >> A;
    if(A == 10 || A == 100) sum();
    else FizzBuzz();
}
0