結果
| 問題 |
No.3204 Permuted Integer
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-07-25 15:09:02 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,206 bytes |
| コンパイル時間 | 438 ms |
| コンパイル使用メモリ | 12,160 KB |
| 実行使用メモリ | 10,240 KB |
| 最終ジャッジ日時 | 2025-07-25 15:09:09 |
| 合計ジャッジ時間 | 6,130 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | TLE * 1 -- * 25 |
ソースコード
T = int(input())
for k in range(T):
N = input()
num_dict = {
0: N.count("0"),
1: N.count("1"),
2: N.count("2"),
3: N.count("3"),
4: N.count("4"),
5: N.count("5"),
6: N.count("6"),
7: N.count("7"),
8: N.count("8"),
9: N.count("9"),
}
ret = -1
i = 1
while i * i < 1e9:
i_sqr_str = str(i * i)
if i_sqr_str.count("0") <= num_dict[0]:
if i_sqr_str.count("1") == num_dict[1]:
if i_sqr_str.count("2") == num_dict[2]:
if i_sqr_str.count("3") == num_dict[3]:
if i_sqr_str.count("4") == num_dict[4]:
if i_sqr_str.count("5") == num_dict[5]:
if i_sqr_str.count("6") == num_dict[6]:
if i_sqr_str.count("7") == num_dict[7]:
if i_sqr_str.count("8") == num_dict[8]:
if i_sqr_str.count("9") == num_dict[9]:
ret = i * i
break
i += 1
print(ret)