結果

問題 No.1644 Eight Digits
ユーザー karaage
提出日時 2021-09-11 23:45:52
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 1,000 ms
コード長 584 bytes
コンパイル時間 1,823 ms
コンパイル使用メモリ 167,180 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-23 09:30:33
合計ジャッジ時間 2,852 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

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;
}

int main(){
    int k;
    cin >> k;
    string s="12345678";
    int count=0;
    while(1){
        if(stoi(s)%k==0)count++;
        if(!next_permutation(ALL(s)))break;
    }
    printf("%d\n",count);
}
0