結果
| 問題 | No.346 チワワ数え上げ問題 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-02-28 11:07:14 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 101 ms / 2,000 ms |
| コード長 | 299 bytes |
| 記録 | |
| コンパイル時間 | 336 ms |
| コンパイル使用メモリ | 20,444 KB |
| 実行使用メモリ | 16,348 KB |
| 最終ジャッジ日時 | 2026-04-11 16:55:50 |
| 合計ジャッジ時間 | 3,836 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
def main():
s = input()
l = []
n = 0
for c in s[::-1]:
if c == 'w':
n += 1
elif c == 'c':
l.append(n)
ans = 0
for x in l:
if x >= 2:
ans += x * (x - 1) // 2
print(ans)
if __name__ == '__main__':
main()