結果
問題 | No.2063 ±2^k operations (easy) |
ユーザー |
![]() |
提出日時 | 2025-03-20 20:25:04 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 37 ms / 2,000 ms |
コード長 | 662 bytes |
コンパイル時間 | 137 ms |
コンパイル使用メモリ | 82,600 KB |
実行使用メモリ | 58,456 KB |
最終ジャッジ日時 | 2025-03-20 20:26:32 |
合計ジャッジ時間 | 1,872 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
def main():s = input().strip()cnt_1 = s.count('1')# Check condition A: exactly two '1's and non-consecutiveif cnt_1 == 2:first = s.find('1')second = s.find('1', first + 1)if second != first + 1:print("Yes")return# Check condition B: contiguous '1's followed by '0's onlypos = 0while pos < len(s) and s[pos] == '1':pos += 1rest = s[pos:]condition_b = '1' not in restif condition_b:if cnt_1 == 1:print("No")else:print("Yes")else:print("No")if __name__ == "__main__":main()