結果

問題 No.1644 Eight Digits
ユーザー Kome_soudou
提出日時 2022-12-19 22:14:49
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 362 bytes
コンパイル時間 1,791 ms
コンパイル使用メモリ 169,528 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-18 01:25:50
合計ジャッジ時間 2,094 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
	int k;
	cin >> k;
	
	vector<int> p(8);
	for(int i = 0; i < 8; i++) p[i] = i + 1;
	int ans = 0;
	int cnt;
	do
	{
		cnt = p[0];
		for(int i = 1; i < 8; i++)
		{
			cnt *= 10;
			cnt += p[i];
		}
		if(cnt % k == 0) ans++;
	} while(next_permutation(p.begin(), p.end()));
	cout << ans << endl;
	return 0;
}
0