結果

問題 No.1469 programing
ユーザー harurunharurun
提出日時 2021-04-03 01:21:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,059 ms / 3,000 ms
コード長 555 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 17,788 KB
最終ジャッジ日時 2023-08-26 04:17:52
合計ジャッジ時間 4,273 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,844 KB
testcase_01 AC 15 ms
7,940 KB
testcase_02 AC 16 ms
7,900 KB
testcase_03 AC 16 ms
7,836 KB
testcase_04 AC 15 ms
7,968 KB
testcase_05 AC 16 ms
7,872 KB
testcase_06 AC 15 ms
7,820 KB
testcase_07 AC 16 ms
7,820 KB
testcase_08 AC 58 ms
8,236 KB
testcase_09 AC 73 ms
8,268 KB
testcase_10 AC 69 ms
8,364 KB
testcase_11 AC 106 ms
8,632 KB
testcase_12 AC 81 ms
8,316 KB
testcase_13 AC 16 ms
7,816 KB
testcase_14 AC 136 ms
8,576 KB
testcase_15 AC 139 ms
8,668 KB
testcase_16 AC 219 ms
8,888 KB
testcase_17 AC 2,059 ms
17,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
  S=input()
  assert(0<=len(S)<=5*(10**6))
  if len(S)!=0:
    #英小文字かどうか
    for i in S:
      assert(ord("a")<=ord(i)<=ord("z"))
    if len(S)>2:
      #3文字以上続いてないか(3文字続いているかの確認で3文字以上も確認できる)
      for i in range(len(S)-2):
        if S[i]==S[i+1] and S[i+1]==S[i+2]:
          raise Exception("3 or more continues.")
  if len(S)<2:
    print(S)
    return
  ans=S[0]
  for i in range(1,len(S)):
    if S[i-1]!=S[i]:
      ans+=S[i]
  print(ans)
  return

main()
0