結果
問題 |
No.873 バイナリ、ヤバいなり!w
|
ユーザー |
![]() |
提出日時 | 2019-09-04 16:02:01 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 728 bytes |
コンパイル時間 | 228 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-06-24 06:38:38 |
合計ジャッジ時間 | 2,405 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 16 WA * 20 |
ソースコード
from math import sqrt n = int(input()) def square_number_list(n, current_list): if n == 0: return current_list base = int(sqrt(n)) if base == sqrt(n): return current_list + [base] else: return square_number_list(n - base * base, current_list + [base]) candidate = square_number_list(n, []) def make_candidate_binary(candidate): current_binary = 0 current_string = "" for number in candidate: for i in range(0, number): current_string += str(current_binary) if i < number - 1: current_binary = 0 if current_binary == 1 else 1 return current_string candidate.reverse() print("".join(make_candidate_binary(candidate)))