結果
問題 | No.1644 Eight Digits |
ユーザー | startcpp |
提出日時 | 2021-08-13 22:11:14 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 392 bytes |
コンパイル時間 | 684 ms |
コンパイル使用メモリ | 73,016 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-03 19:24:39 |
合計ジャッジ時間 | 1,694 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int i; vector<int> p; for (i = 1; i <= 8; i++) p.push_back(i); int K; cin >> K; int ans = 0; do { int num = 0; for (i = 0; i < 8; i++) { num *= 10; num += p[i]; } if (num % K == 0) ans++; } while (next_permutation(p.begin(), p.end())); cout << ans << endl; return 0; }