結果
| 問題 | No.346 チワワ数え上げ問題 |
| コンテスト | |
| ユーザー |
No
|
| 提出日時 | 2016-06-09 18:43:39 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 781 bytes |
| 記録 | |
| コンパイル時間 | 3,409 ms |
| コンパイル使用メモリ | 105,600 KB |
| 実行使用メモリ | 40,900 KB |
| 最終ジャッジ日時 | 2024-10-09 06:17:44 |
| 合計ジャッジ時間 | 5,686 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 4 WA * 5 RE * 11 TLE * 1 -- * 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();
int ans = 0;
for (int i = 0; i < s.Length; i++)
{
if (!s[i].Equals('c')) continue;
int w = s.Substring(i).Where(x => x.Equals('w')).Count();
ans += calc(w) / (2 * calc(w - 2));
}
Console.WriteLine("{0}", ans);
}
static int calc(int a)
{
int r = 1;
for (int i = 1; i <= a; i++)
{
r *= i;
}
return r;
}
}
}
No