結果

問題 No.2063 ±2^k operations (easy)
ユーザー lam6er
提出日時 2025-03-20 20:32:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 601 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 82,716 KB
実行使用メモリ 72,304 KB
最終ジャッジ日時 2025-03-20 20:32:58
合計ジャッジ時間 1,951 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input().strip()
count_ones = s.count('1')

if count_ones == 2:
    print("Yes")
else:
    def check_condition_a(s):
        if '0' not in s:
            return True
        first_zero = s.index('0')
        return all(c == '0' for c in s[first_zero:])
    
    def check_condition_b(s):
        if len(s) == 1:
            return False
        if s[0] == '1' and all(c == '0' for c in s[1:]):
            return False
        return True
    
    if check_condition_a(s):
        if check_condition_b(s):
            print("Yes")
        else:
            print("No")
    else:
        print("No")
0