結果

問題 No.8022 縛りFizzBuzz (Easy)
ユーザー imulan
提出日時 2017-03-31 23:09:38
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 578 bytes
コンパイル時間 773 ms
コンパイル使用メモリ 74,540 KB
実行使用メモリ 6,940 KB
最終ジャッジ日時 2024-07-07 05:21:15
合計ジャッジ時間 1,187 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define pb push_back

void ans(int n)
{
    vector<string> ans;
    while(n)
    {
        if(!(n%('p'-'a'))) ans.pb("FizzBuzz");
        else if(!(n%('d'-'a'))) ans.pb("Fizz");
        else if(!(n%('f'-'a'))) ans.pb("Buzz");
        else ans.pb(to_string(n));
        n--;
    }

    reverse(all(ans));
    for(int i='a'-'a'; i<ans.size(); ++i) cout << ans[i] << endl;
}

int main()
{
    int n;
    cin >>n;
    ans(n);
}
0