結果
| 問題 |
No.2562 数字探しゲーム(緑以下コンver.)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-02-15 12:38:39 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,202 bytes |
| コンパイル時間 | 948 ms |
| コンパイル使用メモリ | 102,616 KB |
| 実行使用メモリ | 16,968 KB |
| 最終ジャッジ日時 | 2024-11-19 21:41:54 |
| 合計ジャッジ時間 | 32,719 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | TLE * 10 |
ソースコード
#define _USE_MATH_DEFINES
#include <iostream> //cin, cout
#include <vector> //vector
#include <algorithm> //sort,min,max,count
#include <string> //string,getline, to_string
#include <cstdlib> //abs(int)
#include <utility> //swap, pair
#include <tuple> //tuple
#include <deque> //deque
#include <climits> //INT_MAX
#include <bitset> //bitset
#include <cmath> //sqrt, ceil. M_PI, pow, sin
#include <ios> //fixed
#include <iomanip> //setprecision
#include <sstream> //stringstream
#include <numeric> //gcd, assumlate
#include <random> //randam_device
#include <limits> //numeric_limits
using namespace std;
constexpr long long int D_MOD = 1000000007;
int main() {
int T;
cin >> T;
int64_t M, X;
int d;
string S, A, B;
for (int i = 0; i < T; i++) {
cin >> M;
X = M;
S.clear();
for (int j = 1; j <= 9; j++) {
cin >> d;
if (d != 0) {
for (int k = 0; k < d; k++) {
S.push_back(j + '0');
}
}
}
if (M == 1) {
cout << S << endl;
continue;
}
B = S;
sort(B.begin(), B.end());
while (1) {
A = to_string(X);
sort(A.begin(), A.end());
if (A == B) {
cout << X << endl;
break;
}
X += M;
}
}
return 0;
}