結果
問題 |
No.1644 Eight Digits
|
ユーザー |
![]() |
提出日時 | 2021-08-13 21:22:17 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 368 bytes |
コンパイル時間 | 1,590 ms |
コンパイル使用メモリ | 169,924 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-03 16:48:00 |
合計ジャッジ時間 | 2,557 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ int K; cin >> K; vector<int> p = {1, 2, 3, 4, 5, 6, 7, 8}; int ans = 0; while (true){ int s = 0; for (int i = 0; i < 8; i++){ s = s * 10 + p[i]; } if (s % K == 0){ ans++; } if (!next_permutation(p.begin(), p.end())){ break; } } cout << ans << endl; }