結果
問題 | No.1644 Eight Digits |
ユーザー |
|
提出日時 | 2021-09-14 22:41:34 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 1,000 ms |
コード長 | 462 bytes |
コンパイル時間 | 629 ms |
コンパイル使用メモリ | 71,808 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-27 14:23:54 |
合計ジャッジ時間 | 1,933 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <iostream>#include <vector>#include <algorithm>using namespace std;typedef long long LL;int main(){vector<int> myVec(8);int i;for (i = 1; i <= 8; i++) {myVec[i-1] = i;}int K;cin >> K;int ans = 0;do {LL num = 0;int N = 10000000;for (i = 0; i < 8; i++) {num += myVec[i] * N;N /= 10;}if (num %K == 0) {ans++;}} while (next_permutation(myVec.begin(), myVec.end()));cout << ans << endl;return 0;}