結果

問題 No.294 SuperFizzBuzz
ユーザー Tsuneo YoshiokaTsuneo Yoshioka
提出日時 2015-10-23 22:57:25
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 120 ms / 5,000 ms
コード長 840 bytes
コンパイル時間 449 ms
コンパイル使用メモリ 60,860 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-30 07:24:45
合計ジャッジ時間 1,827 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 120 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 8 ms
4,376 KB
testcase_09 AC 70 ms
4,376 KB
testcase_10 AC 66 ms
4,376 KB
testcase_11 AC 111 ms
4,376 KB
testcase_12 AC 112 ms
4,380 KB
testcase_13 AC 114 ms
4,376 KB
testcase_14 AC 120 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;
int main(void){
    // Here your code !
    int N;
    cin >> N;
    
    ll count=0;
    ll total;
    vector<int> val;
    val.push_back(5);
    total = 5;
    
    while(true){
        int i=1;
        while(i<val.size() && val[i]==5){
            val[i]=3;
            total += 1;
            i++;
        }
        if(i==val.size()){
            val.push_back(3);
            total += 3;
        }else{ /* 3 */
            val[i] = 5;
            total += 2;
        }
        total %= 3;
        if(total%3==0){
            count++;
            if(count == N){
                for(int i=val.size()-1;i>=0;i--){
                    cout << val[i];
                }
                cout << endl;
                exit(0);
            }
        }
    }
}
0