結果
問題 | No.346 チワワ数え上げ問題 |
ユーザー | mban |
提出日時 | 2016-12-23 14:07:57 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 668 bytes |
コンパイル時間 | 4,282 ms |
コンパイル使用メモリ | 103,824 KB |
実行使用メモリ | 46,220 KB |
最終ジャッジ日時 | 2023-08-21 07:32:59 |
合計ジャッジ時間 | 10,015 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 57 ms
32,608 KB |
testcase_01 | AC | 58 ms
23,424 KB |
testcase_02 | AC | 56 ms
23,452 KB |
testcase_03 | AC | 56 ms
21,396 KB |
testcase_04 | AC | 56 ms
21,380 KB |
testcase_05 | AC | 55 ms
21,524 KB |
testcase_06 | AC | 57 ms
23,488 KB |
testcase_07 | AC | 58 ms
21,408 KB |
testcase_08 | AC | 57 ms
21,576 KB |
testcase_09 | AC | 56 ms
21,372 KB |
testcase_10 | AC | 164 ms
44,212 KB |
testcase_11 | AC | 91 ms
39,340 KB |
testcase_12 | AC | 120 ms
44,108 KB |
testcase_13 | AC | 82 ms
32,384 KB |
testcase_14 | AC | 58 ms
21,476 KB |
testcase_15 | AC | 115 ms
46,180 KB |
testcase_16 | AC | 142 ms
46,176 KB |
testcase_17 | AC | 176 ms
46,220 KB |
testcase_18 | AC | 157 ms
44,128 KB |
testcase_19 | AC | 145 ms
46,148 KB |
testcase_20 | AC | 59 ms
24,356 KB |
testcase_21 | TLE | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Text.RegularExpressions; using System.Linq; class Magatro { static void Main() { string S = Console.ReadLine(); List<int> cnt = new List<int>(); for (int i = 0; i < S.Length; i++) { if (S[i] == 'c') cnt.Add(0); else if (S[i] == 'w') cnt = cnt.Select(s => s+=1).ToList(); } long ans = cnt.Select(s => Combination(s)).Sum(); Console.WriteLine(ans); } static long Combination(int n) { return n * (n - 1) / 2; } }