結果

問題 No.1631 Sorting Integers (Multiple of K) Easy
ユーザー karaagekaraage
提出日時 2021-09-15 22:28:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,090 bytes
コンパイル時間 1,477 ms
コンパイル使用メモリ 167,752 KB
実行使用メモリ 7,512 KB
最終ジャッジ日時 2023-09-11 09:37:48
合計ジャッジ時間 7,211 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 19 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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);
}
0