結果
| 問題 |
No.2562 数字探しゲーム(緑以下コンver.)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-12-02 14:47:31 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 725 bytes |
| コンパイル時間 | 2,118 ms |
| コンパイル使用メモリ | 194,472 KB |
| 最終ジャッジ日時 | 2025-02-18 03:56:18 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 3 TLE * 1 -- * 6 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int test; cin >> test;
while(test--){
long long M; cin >> M;
long long power10 = 1;
while(M%10 == 0) power10 *= 10,M /= 10;
string s = "";
for(int i=1; i<=9; i++){
int d; cin >> d;
while(d--) s += '0'+i;
}
bool ok = false;
do{
long long now = stoll(s);
if(now%M == 0){
ok = true;
cout << now*power10 << endl;
break;
}
}while(next_permutation(s.begin(),s.end()));
if(!ok) cout << -1 << endl;
}
}