結果

問題 No.1644 Eight Digits
ユーザー phsplsphspls
提出日時 2022-10-03 10:29:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 17 ms / 1,000 ms
コード長 448 bytes
コンパイル時間 3,958 ms
コンパイル使用メモリ 201,024 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-27 05:57:46
合計ジャッジ時間 4,677 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

signed main() {
    int k; cin >> k;
    vector<int> vals;
    for(int i=1; i<=8; i++) vals.emplace_back(i);

    int result = 0;
    do {
        int value = 0;
        for (int i=0; i<8; i++) {
            value += vals[i] * int(pow(10, i));
        }
        if (value % k == 0) result++;
    } while (next_permutation(vals.begin(), vals.end()));

    cout << result << endl;
}
0