結果

問題 No.1644 Eight Digits
ユーザー ぷらぷら
提出日時 2021-08-13 21:24:03
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 413 bytes
コンパイル時間 1,983 ms
コンパイル使用メモリ 195,884 KB
最終ジャッジ日時 2025-01-23 18:03:57
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int K;
    cin >> K;
    vector<int>cnt = {1,2,3,4,5,6,7,8};
    int ans = 0;
    do {
        int res = 0;
        for(int i = 0; i < cnt.size(); i++) {
            res *= 10;
            res += cnt[i];
        }
        if(res%K == 0) {
            ans++;
        }
    }while (next_permutation(cnt.begin(),cnt.end()));
    cout << ans << endl;
}
0