結果
問題 |
No.1631 Sorting Integers (Multiple of K) Easy
|
ユーザー |
![]() |
提出日時 | 2021-09-15 22:28:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,090 bytes |
コンパイル時間 | 1,539 ms |
コンパイル使用メモリ | 169,380 KB |
実行使用メモリ | 10,144 KB |
最終ジャッジ日時 | 2024-06-29 00:16:14 |
合計ジャッジ時間 | 6,434 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 TLE * 1 -- * 17 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; using ull=unsigned long long; const ll MOD=1000000000+7; #define rep(I,N) for(int I=0;I<N;I++) #define ALL(x) x.begin(),x.end() #define PRINTV(x) for(auto i:x){for(auto j:i){printf("%d\t",j);}printf("\n");} using vec = vector<int>; using vvec = vector<vector<int>>; ll lcm(ll a,ll b){ return a/__gcd(a,b)*b; } template<class T> void HorRot(vector<vector<T>>& v){ for(int i=0;i<v.size()/2;i++){ v[i].swap(v[v.size()-i-1]); } } template<class T> void DiaRot(vector<vector<T>>& v){ for(int i=0;i<v.size()-1;i++){ for(int j=i+1;j<v.size();j++){ swap(v[i][j],v[j][i]); } } } template<class T> void Rot90(vector<vector<T>>& v){ HorRot(v); DiaRot(v); } int main(){ int n,k; cin >> n >> k; string s=""; int ans=0; rep(i,9){ int x; cin >> x; rep(j,x){ s=s+to_string(i+1); } } while(1){ if(stoll(s)%k==0)ans++; if(!next_permutation(ALL(s)))break; } printf("%d\n",ans); }