結果

問題 No.346 チワワ数え上げ問題
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2018-06-23 11:48:02
言語 Nim
(2.2.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 193 bytes
コンパイル時間 2,799 ms
コンパイル使用メモリ 61,880 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 18:16:51
合計ジャッジ時間 3,732 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

import algorithm

let S = stdin.readLine
var ttl, cnt_w = 0

for s in S.reversed:
  case s
  of 'w':
    cnt_w += 1
  of 'c':
    ttl += cnt_w * (cnt_w - 1) div 2
  else:
    discard

echo ttl
0