結果

問題 No.294 SuperFizzBuzz
ユーザー chocoruskchocorusk
提出日時 2019-05-26 10:34:14
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 149 ms / 5,000 ms
コード長 863 bytes
コンパイル時間 803 ms
コンパイル使用メモリ 99,020 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-17 17:52:43
合計ジャッジ時間 2,530 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 149 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 10 ms
4,348 KB
testcase_09 AC 84 ms
4,348 KB
testcase_10 AC 85 ms
4,348 KB
testcase_11 AC 138 ms
4,348 KB
testcase_12 AC 143 ms
4,348 KB
testcase_13 AC 145 ms
4,348 KB
testcase_14 AC 148 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main()
{
    int n; cin>>n;
    int cnt=0;
    for(int i=3; i<=25; i++){
        for(int j=1; j<(1<<i); j+=2){
            if(popcount(j)%3==0) cnt++;
            if(cnt==n){
                for(int k=i-1; k>=0; k--){
                    if(j&(1<<k)) cout<<"5";
                    else cout<<"3";
                }
                cout<<endl;
                return 0;
            }
        }
    }
    return 0;
}
0