結果

問題 No.346 チワワ数え上げ問題
ユーザー nak2yoshi
提出日時 2016-02-27 00:25:47
言語 D
(dmd 2.109.1)
結果
TLE  
実行時間 -
コード長 402 bytes
コンパイル時間 2,246 ms
コンパイル使用メモリ 148,480 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-06-12 03:08:10
合計ジャッジ時間 11,126 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other AC * 20 TLE * 1 -- * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio,
       std.conv,
       std.string,
       std.range,
       std.math,
       std.bigint,
       std.algorithm,
       core.bitop;

void main()
{
    auto S = readln.strip;

    BigInt ans = 0;
    foreach (i, e; S[0 .. $ - 2])
    {
        if (e != 'c')
            continue;

        BigInt wc = S[i .. $].count!`a=='w'`;
        ans += wc * (wc - 1) / 2;
    }
    ans.writeln;
}
0