Flying Cat Penguin

ゆるゆる仕事、ソフトウェアテスティング関連のことについて綴ります。

AtCoder 修行日記#74

74日目
ABCのC問題に取り組み中。
茶色レベルのD問題も余裕があれば取り組み中。

勉強用のコンテンツはここから。
https://kenkoooo.com/atcoder/#/table/

進捗と一言感想

[C問題] 1問(残り134問)

ABC124: Coloring Colorfully

最小という言葉に惑わされ悩んだので、回答を参考にAC。
単純なケースで最小にできない気がするのは気のせいだろうか…。要復習。

s = list(input())
 
count = 0
for i in range(len(s)-1):
  if s[i] == s[i+1] and s[i] == "0":
    s[i+1] = "1"
    count += 1
  elif s[i] == s[i+1] and s[i] == "1":
    s[i+1] = "0"
    count += 1
  else:
    pass
  
print(count)
目標
  • まず、今年中に茶色コーダー
学習方針

以上。