結果

問題 No.1644 Eight Digits
ユーザー forest3
提出日時 2021-08-18 00:57:16
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 332 bytes
コンパイル時間 1,543 ms
コンパイル使用メモリ 170,568 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-11 01:37:05
合計ジャッジ時間 2,538 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main()
{
	int K;
	cin >> K;

	vector<int> n;
	for( int i = 1; i <= 8; i++ ) n.push_back( i );
	int ans = 0;
	do  {
		int s = 0;
		for( int i = 0; i < 8; i++ ) s = s * 10 + n[i];
		if( s % K == 0 ) ans++;
	} while( next_permutation( n.begin(), n.end() ) );

	cout << ans << endl;
}
0