結果
問題 |
No.294 SuperFizzBuzz
|
ユーザー |
![]() |
提出日時 | 2015-10-23 23:33:59 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 920 bytes |
コンパイル時間 | 919 ms |
コンパイル使用メモリ | 54,616 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-23 18:10:08 |
合計ジャッジ時間 | 1,634 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 6 WA * 6 |
ソースコード
#include <iostream> #include <string> #include <stdio.h> using namespace std; #define LL long long LL calc(LL d){ LL res=0; LL up=1; LL down=1; for(LL i = 1; i <= d; i++){ up*=d-i+1; down*=i; if(i%3==2) res+=up/down; } return res; } int main() { LL N; cin>>N; LL d=2; LL prev=0; while(true){ LL now=calc(d); // cout<<now<<endl; if(prev+now>=N)break; prev+=now; d++; } //printf("prev=%lld,d=%lld\n",prev,d); for(int bit=0;bit<(1<<d);bit++){ if(__builtin_popcount(bit)%3==2){ prev++; //cout<<prev<<endl; if(prev==N){ for(int i=d-1;i>=0;i--){ int k=((((bit>>i)&1)==1)?5:3); cout<<k; } break; } } } cout<<5<<endl; return 0; }