結果
問題 |
No.346 チワワ数え上げ問題
|
ユーザー |
![]() |
提出日時 | 2016-06-09 19:10:08 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 612 bytes |
コンパイル時間 | 1,934 ms |
コンパイル使用メモリ | 111,800 KB |
実行使用メモリ | 45,868 KB |
最終ジャッジ日時 | 2024-10-09 06:18:32 |
合計ジャッジ時間 | 19,552 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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(); if (w < 2) continue; ans += w * (w - 1 ) / 2; } Console.WriteLine(ans); } } }