結果
| 問題 |
No.1924 3 color painting on a line
|
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 14:43:59 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 286 bytes |
| コンパイル時間 | 194 ms |
| コンパイル使用メモリ | 82,312 KB |
| 実行使用メモリ | 64,540 KB |
| 最終ジャッジ日時 | 2025-06-12 14:44:46 |
| 合計ジャッジ時間 | 3,491 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 43 |
ソースコード
n = int(input())
s = input().strip()
if n == 0:
print(0)
exit()
# Calculate the number of runs
runs = 1
for i in range(1, n):
if s[i] != s[i-1]:
runs += 1
if runs == 1:
print(1)
else:
if s[0] == s[-1]:
print(runs - 1)
else:
print(runs)
gew1fw