結果
問題 |
No.346 チワワ数え上げ問題
|
ユーザー |
![]() |
提出日時 | 2016-02-29 20:59:09 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 574 bytes |
コンパイル時間 | 1,077 ms |
コンパイル使用メモリ | 110,388 KB |
実行使用メモリ | 26,784 KB |
最終ジャッジ日時 | 2024-09-24 12:53:43 |
合計ジャッジ時間 | 2,625 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 WA * 2 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Linq; namespace ConsoleApplication6 { class Program { static void Main(string[] args) { var s = Console.ReadLine(); var w = s.Count(x => x == 'w'); var answer = s.Aggregate(0L, (sum, x) => { if (x == 'w') { w--; } if (x == 'c') { sum += w * (w - 1) / 2; } return sum; }); Console.WriteLine(answer); } } }