結果
| 問題 |
No.1644 Eight Digits
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-06-05 14:39:09 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 1,000 ms |
| コード長 | 443 bytes |
| コンパイル時間 | 1,861 ms |
| コンパイル使用メモリ | 170,636 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-29 06:07:34 |
| 合計ジャッジ時間 | 2,988 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
long long GCD(long long a,long long b) {
if(a%b == 0) return b;
return GCD(b,a%b);
}
int main() {
int K; cin >> K;
string S = "12345678";
int count = 0;
sort(S.begin(),S.end());
do{
if(stoi(S) % K == 0) {
count++;
}
}while(next_permutation(S.begin(),S.end()));
cout << count << endl;
}