結果

問題 No.1644 Eight Digits
ユーザー kekenx
提出日時 2022-11-17 16:53:52
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 415 bytes
コンパイル時間 1,684 ms
コンパイル使用メモリ 195,804 KB
最終ジャッジ日時 2025-02-08 20:51:30
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
  int k;
  cin >> k;
  vector<int> digits(8);
  iota(digits.begin(), digits.end(), 1);
  int ans = 0;
  do {
    int current = 0;
    for (const int& digit : digits) {
      current *= 10;
      current += digit;
    }
    if (current % k == 0)
      ans++;
  } while (next_permutation(digits.begin(), digits.end()));
  cout << ans << '\n';
  return 0;
}
0