結果

問題 No.1644 Eight Digits
ユーザー ripity
提出日時 2021-12-18 15:12:46
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 16 ms / 1,000 ms
コード長 335 bytes
コンパイル時間 2,251 ms
コンパイル使用メモリ 194,608 KB
最終ジャッジ日時 2025-01-27 03:18:31
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(void){
    vector<int> p = {1,2,3,4,5,6,7,8};
    int K;
    int ans = 0;
    cin >> K;
    do {
        int N = 0;
        for( int i = 0; i < 8; i++ ) N += pow(10,i)*p[i];
        if( N%K == 0 ) ans++;
    }while(next_permutation(p.begin(),p.end()));
    cout << ans << endl;
}
0