結果
| 問題 |
No.1644 Eight Digits
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-08-16 17:45:14 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 30 ms / 1,000 ms |
| コード長 | 457 bytes |
| コンパイル時間 | 671 ms |
| コンパイル使用メモリ | 76,796 KB |
| 最終ジャッジ日時 | 2025-01-23 22:34:08 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int main(){
long long k;
cin >> k;
long long ans = 0;
vector<int> a = {'1', '2', '3', '4', '5', '6', '7', '8'};
do{
string s;
for (int i = 0; i < 8; i++) s.push_back(a[i]);
long long num = stoll(s);
if (num%k == 0) ans++;
}while(next_permutation(a.begin(), a.end()));
cout << ans << endl;
}