結果
| 問題 |
No.559 swapAB列
|
| コンテスト | |
| ユーザー |
turner18_jp
|
| 提出日時 | 2017-12-11 19:48:11 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 30 ms / 2,000 ms |
| コード長 | 287 bytes |
| コンパイル時間 | 100 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-11-30 11:40:16 |
| 合計ジャッジ時間 | 1,019 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 |
ソースコード
s = list(input())
def f(s):
count = 0
total = 0
while True:
count = 0
for i in range(len(s)-1):
if s[i] == 'B':
if s[i+1] == 'A':
s[i], s[i+1] = s[i+1], s[i]
count += 1
total += count
if count == 0:
return total
print(f(s))
turner18_jp