結果

問題 No.346 チワワ数え上げ問題
ユーザー cympfhcympfh
提出日時 2016-02-29 15:12:09
言語 Ruby
(3.3.0)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 95 bytes
コンパイル時間 576 ms
コンパイル使用メモリ 11,148 KB
実行使用メモリ 23,516 KB
最終ジャッジ日時 2023-08-27 01:33:40
合計ジャッジ時間 5,350 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
14,996 KB
testcase_01 AC 75 ms
15,060 KB
testcase_02 AC 74 ms
15,260 KB
testcase_03 AC 75 ms
14,976 KB
testcase_04 AC 76 ms
15,000 KB
testcase_05 AC 75 ms
14,984 KB
testcase_06 AC 76 ms
15,240 KB
testcase_07 AC 78 ms
15,092 KB
testcase_08 AC 75 ms
15,120 KB
testcase_09 AC 74 ms
15,244 KB
testcase_10 AC 131 ms
23,444 KB
testcase_11 AC 108 ms
19,512 KB
testcase_12 AC 124 ms
22,352 KB
testcase_13 AC 103 ms
19,256 KB
testcase_14 AC 78 ms
15,272 KB
testcase_15 AC 120 ms
21,688 KB
testcase_16 AC 128 ms
22,236 KB
testcase_17 AC 130 ms
23,356 KB
testcase_18 AC 130 ms
23,376 KB
testcase_19 AC 127 ms
22,540 KB
testcase_20 AC 132 ms
23,480 KB
testcase_21 AC 135 ms
23,396 KB
testcase_22 AC 138 ms
23,516 KB
testcase_23 AC 77 ms
14,980 KB
testcase_24 AC 74 ms
15,296 KB
testcase_25 AC 74 ms
15,112 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

s=gets.chomp.chars
y=s.count{|c|c=='w'}
a=0
s.map{|c|y-=1 if c=='w'
a+=y*(y-1)/2 if c=='c'}
p a
0