結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
okazuki
|
| 提出日時 | 2016-02-29 20:58:13 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 573 bytes |
| コンパイル時間 | 893 ms |
| コンパイル使用メモリ | 114,716 KB |
| 実行使用メモリ | 28,628 KB |
| 最終ジャッジ日時 | 2024-09-24 12:53:35 |
| 合計ジャッジ時間 | 2,358 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 9 |
コンパイルメッセージ
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(0, (sum, x) =>
{
if (x == 'w') { w--; }
if (x == 'c')
{
sum += w * (w - 1) / 2;
}
return sum;
});
Console.WriteLine(answer);
}
}
}
okazuki