結果
| 問題 | 
                            No.873 バイナリ、ヤバいなり!w
                             | 
                    
| コンテスト | |
| ユーザー | 
                             LMMP
                         | 
                    
| 提出日時 | 2019-09-04 15:53:48 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 708 bytes | 
| コンパイル時間 | 165 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 11,008 KB | 
| 最終ジャッジ日時 | 2024-06-24 06:38:41 | 
| 合計ジャッジ時間 | 2,610 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 WA * 2 | 
| other | AC * 10 WA * 26 | 
ソースコード
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
print("".join(make_candidate_binary(candidate)))
            
            
            
        
            
LMMP