結果
問題 |
No.911 ラッキーソート
|
ユーザー |
![]() |
提出日時 | 2019-11-26 21:01:46 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 400 bytes |
コンパイル時間 | 104 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-11-07 00:55:58 |
合計ジャッジ時間 | 3,501 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 46 |
ソースコード
#!/usr/bin/env python3 n = int(input()) s = input() s = ''.join(s.split('3')) s = ''.join(s.split('5')) s = ''.join(s.split('7')) ans = n - len(s) c1 = 0 c9 = 0 for c in s: if c == '1': c1 += 1 else: if c1 > 0: ans += 1 c1 -= 1 else: c9 += 1 while c1 >= 1 and c9 >= 2: ans += 1 c1 -= 1 c9 -= 2 ans += c1 // 2 print(ans)