結果
| 問題 |
No.1644 Eight Digits
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-08-13 21:45:07 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,635 bytes |
| コンパイル時間 | 1,521 ms |
| コンパイル使用メモリ | 167,052 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-03 18:12:59 |
| 合計ジャッジ時間 | 8,424 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 12 WA * 13 |
ソースコード
//code of JUYU ^ ^ never doubt youself !
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Rep(i,b,a) for(int i=a;i>=b;--i)
#define ms(a,b) memset(a,b,sizeof a)
#define fir first
#define sec second
#define eb emplace_back
#define pb push_back
#define mk make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int MOD = 1e9 + 7;
const int N = 1e5 + 10;
int ans; //exactly you can get the answer
int main()
{
ll k; scanf("%lld", &k);
int ans = 0;
for (int i1 = 1; i1 <= 9; i1 ++)
{
for (int i2 = 1; i2 <= 8; i2 ++)
for (int i3 = 1; i3 <= 8; i3 ++)
for (int i4 = 1; i4 <= 8; i4 ++)
for (int i5 = 1; i5 <= 8; i5 ++)
for (int i6 = 1; i6 <= 8; i6 ++)
for (int i7 = 1; i7 <= 8; i7 ++)
for (int i8 = 1; i8 <= 8; i8 ++)
{
ll num = i1 * 10000000 + i2 * 1000000 + i3 * 100000 + i4 * 10000 + i5 * 1000 + i6 * 100 + i7 * 10 + i8;
if (num % k == 0 && i1 != i2 && i1 != i3 && i1 != i4 && i1 != i5 && i1 != i6 && i1 != i7 && i1 != i8 && i2 != i3 && i2 != i4 && i2 != i5 && i2 != i6 && i2 != i7 && i2 != i8 && i3 != i4 && i3 != i5 && i3 != i6 && i3 != i7 && i3 != i8 && i4 != i5 && i4 != i6 && i4 != i7 && i4 != i8 && i5 != i6 && i5 != i7 && i5 != i8 && i6 != i7 && i6 != i8 && i7 != i8) ans ++;
}
}
cout << ans << endl;
return 0;
}
/* stuff you should look for
* int overflow, array bounds
* special cases (n=1?)
* do smth instead of nothing and stay organized
* WRITE STUFF DOWN
* DON'T GET STUCK ON ONE APPROACH
-- Benq
*/