結果
| 問題 | No.346 チワワ数え上げ問題 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-03-09 08:34:00 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 604 bytes |
| 記録 | |
| コンパイル時間 | 2,226 ms |
| コンパイル使用メモリ | 108,064 KB |
| 実行使用メモリ | 27,776 KB |
| 最終ジャッジ日時 | 2024-09-24 16:35:12 |
| 合計ジャッジ時間 | 2,019 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 23 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
namespace No346
{
class Program
{
static void Main(string[] args)
{
long num = 0;
long count = 0;
string text = Console.ReadLine();
Console.WriteLine();
Console.WriteLine(text);
Console.WriteLine();
for (int i = text.Length - 1; i >= 0; i--)
{
if (text[i] == 'w')
count++;
if (text[i] == 'c')
num += count * (count - 1) / 2;
}
Console.WriteLine(num);
}
}
}