結果

問題 No.1644 Eight Digits
コンテスト
ユーザー π
提出日時 2021-08-13 21:51:11
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 1,000 ms
+ 981µs
コード長 343 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 255 ms
コンパイル使用メモリ 71,552 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2026-09-09 19:27:52
合計ジャッジ時間 2,349 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <cstdio>
#include <algorithm>

int main() {
  int a, count = 0;
  int b[] = {1, 2, 3, 4, 5, 6, 7, 8};
  std::scanf("%d", &a);
  do {
    int n = 0, d = 1;
    for(int i = 0; i < 8; ++i) {
      n += b[i] * d;
      d *= 10;
    }
    if(n % a == 0) ++count;
  } while(std::next_permutation(b, b + 8));
  std::printf("%d\n", count);
}
0