結果
問題 | No.346 チワワ数え上げ問題 |
ユーザー |
![]() |
提出日時 | 2016-06-09 19:12:13 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 575 bytes |
コンパイル時間 | 1,099 ms |
コンパイル使用メモリ | 110,564 KB |
実行使用メモリ | 45,488 KB |
最終ジャッジ日時 | 2024-10-09 06:19:01 |
合計ジャッジ時間 | 21,378 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 17 TLE * 4 -- * 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.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace yukikoda { class Program { static void Main(string[] args) { string s = Console.ReadLine(); long ans = 0; for (int i = 0; i < s.Length; i++) { if (!s[i].Equals('c')) continue; long w = s.Substring(i).Where(x => x.Equals('w')).Count(); ans += w * (w - 1 ) / 2; } Console.WriteLine(ans); } } }