結果
問題 | No.1631 Sorting Integers (Multiple of K) Easy |
ユーザー |
|
提出日時 | 2023-07-23 20:02:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 415 bytes |
コンパイル時間 | 1,744 ms |
コンパイル使用メモリ | 169,328 KB |
実行使用メモリ | 13,880 KB |
最終ジャッジ日時 | 2024-09-24 23:22:41 |
合計ジャッジ時間 | 6,400 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 TLE * 1 -- * 17 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; vector<int> cnt(10); string s; for(int i = 1; i < 10; i++){ cin >> cnt[i]; s += string(cnt[i], i + '0'); } int ans = 0; do{ ans += stoll(s) % k == 0; }while(next_permutation(s.begin(), s.end())); cout << ans << '\n'; }