結果

問題 No.1469 programing
ユーザー tktk_snsntktk_snsn
提出日時 2021-04-11 18:32:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,991 ms / 3,000 ms
コード長 320 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 10,640 KB
実行使用メモリ 211,136 KB
最終ジャッジ日時 2023-09-09 20:35:14
合計ジャッジ時間 4,587 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,940 KB
testcase_01 AC 16 ms
7,924 KB
testcase_02 AC 16 ms
7,824 KB
testcase_03 AC 16 ms
7,912 KB
testcase_04 AC 16 ms
7,772 KB
testcase_05 AC 16 ms
7,728 KB
testcase_06 AC 16 ms
7,820 KB
testcase_07 AC 17 ms
7,872 KB
testcase_08 AC 61 ms
13,520 KB
testcase_09 AC 77 ms
15,516 KB
testcase_10 AC 70 ms
14,876 KB
testcase_11 AC 132 ms
25,804 KB
testcase_12 AC 102 ms
20,980 KB
testcase_13 AC 16 ms
7,812 KB
testcase_14 AC 169 ms
31,792 KB
testcase_15 AC 132 ms
19,904 KB
testcase_16 AC 213 ms
28,164 KB
testcase_17 AC 1,991 ms
211,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def RunLengthEncoding(S):
    res = []
    N = len(S)
    i = 0
    while i < N:
        cnt = 1
        while i < N - 1 and S[i] == S[i + 1]:
            cnt += 1
            i += 1
        res.append((S[i], cnt))
        i += 1
    return res


S = RunLengthEncoding(input())
ans = "".join(k for k, v in S)
print(ans)
0