結果

問題 No.1644 Eight Digits
ユーザー 👑 Nachia
提出日時 2021-08-13 21:29:31
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 1,000 ms
コード長 516 bytes
コンパイル時間 2,096 ms
コンパイル使用メモリ 102,624 KB
最終ジャッジ日時 2025-01-23 18:15:29
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using i64 = int64_t;
using u64 = uint64_t;
#define rep(i,n) for(int i=0; i<(n); i++)

int main() {
  string S = "12345678";
  int K; cin >> K;
  int ans = 0;
  do{
    int x = stoi(S);
    if(x % K == 0) ans += 1;
  } while(next_permutation(S.begin(),S.end()));
  cout << ans << endl;
  return 0;
}


struct ios_do_not_sync{
  ios_do_not_sync(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
  }
} ios_do_not_sync_instance;


0