結果
問題 | No.294 SuperFizzBuzz |
ユーザー | mugen_1337 |
提出日時 | 2021-12-02 15:48:12 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 1,425 ms / 5,000 ms |
コード長 | 2,420 bytes |
コンパイル時間 | 2,614 ms |
コンパイル使用メモリ | 207,640 KB |
実行使用メモリ | 266,940 KB |
最終ジャッジ日時 | 2023-09-18 10:19:11 |
合計ジャッジ時間 | 25,968 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,420 ms
265,248 KB |
testcase_01 | AC | 1,425 ms
265,620 KB |
testcase_02 | AC | 1,396 ms
266,940 KB |
testcase_03 | AC | 1,389 ms
266,616 KB |
testcase_04 | AC | 1,399 ms
265,752 KB |
testcase_05 | AC | 1,418 ms
266,128 KB |
testcase_06 | AC | 1,373 ms
265,348 KB |
testcase_07 | AC | 1,377 ms
266,388 KB |
testcase_08 | AC | 1,385 ms
265,620 KB |
testcase_09 | AC | 1,388 ms
265,592 KB |
testcase_10 | AC | 1,367 ms
266,540 KB |
testcase_11 | AC | 1,378 ms
266,580 KB |
testcase_12 | AC | 1,357 ms
265,712 KB |
testcase_13 | AC | 1,358 ms
266,456 KB |
testcase_14 | AC | 1,351 ms
265,788 KB |
ソースコード
#include"bits/stdc++.h" using namespace std; #define ALL(x) begin(x),end(x) #define rep(i,n) for(int i=0;i<(n);i++) #define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; #define mod 1000000007 using ll=long long; const int INF=1000000000; const ll LINF=1001002003004005006ll; int dx[]={1,0,-1,0},dy[]={0,1,0,-1}; // ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;} template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;} struct IOSetup{ IOSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(12); } } iosetup; template<typename T> ostream &operator<<(ostream &os,const vector<T>&v){ for(int i=0;i<(int)v.size();i++) os<<v[i]<<(i+1==(int)v.size()?"":" "); return os; } template<typename T> istream &operator>>(istream &is,vector<T>&v){ for(T &x:v)is>>x; return is; } // 2^127 = 170141183460469231731687303715884105728 ~ 10^38 ostream &operator<<(ostream &os,const __int128 &n){ if(n==0){ os<<0; return os; } __int128 num=n; bool neg=false; if(num<0)neg=true,num=-num; string res=""; while(num>0){ res.push_back('0'+num%10); num/=10; } if(neg) res.push_back('-'); reverse(begin(res),end(res)); os<<res; return os; } istream &operator>>(istream &is,__int128 &n){ string s; is>>s; int idx=0; bool neg=false; if(s[0]=='-')neg=true,idx++; n=0; for(;idx<(int)s.size();idx++){ n=10*n+s[idx]-'0'; } if(neg) n=-n; return is; } __int128 abs128(__int128 x){ return x<0?-x:x; } __int128 gcd128(__int128 a,__int128 b){ if(a==0) return b; if(b==0) return a; return b>0?gcd128(b,a%b):a; } using int128=__int128; signed main(){ int N;cin>>N; vector<int128> V; for(int d=1;d<=25;d++){ for(int j=1;j<=d;j++){ int i=d-j; int s=i*3+j*5; if(s%3) continue; vector<int> v; rep(_,i) v.push_back(3); rep(_,j-1) v.push_back(5); do{ int128 num=0; for(auto &x:v) num=num*10+x; num=num*10+5; V.push_back(num); }while(next_permutation(ALL(v))); } } sort(ALL(V)); cout<<V[N-1]<<endl; return 0; }