結果
| 問題 |
No.1644 Eight Digits
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-08-14 00:57:58 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 621 bytes |
| コンパイル時間 | 789 ms |
| コンパイル使用メモリ | 84,644 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-04 02:36:19 |
| 合計ジャッジ時間 | 1,754 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <cassert>
using namespace std;
using ll = long long;
int main()
{
int k;
cin >> k;
int ans = 0;
vector<int> n(8);
for(int i = 1; i <= 8; i++) n[i-1] = i;
do{
int tmp = 10000000;
int now = n[7];
for(int i = 0; i < 7; i++){
now += n[i]*tmp;
tmp /= 10;
}
if(now%k == 0) ans++;
}while(next_permutation(n.begin(), n.end()));
cout << ans << endl;
return 0;
}