結果
| 問題 |
No.52 よくある文字列の問題
|
| コンテスト | |
| ユーザー |
しらゆき
|
| 提出日時 | 2016-01-11 09:37:19 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 5,000 ms |
| コード長 | 2,231 bytes |
| コンパイル時間 | 976 ms |
| コンパイル使用メモリ | 115,564 KB |
| 実行使用メモリ | 27,800 KB |
| 最終ジャッジ日時 | 2024-09-22 05:24:05 |
| 合計ジャッジ時間 | 1,765 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
static void Main()
{
var s = rs();
var set = new HashSet<string>();
Action<int, int, string> dfs = null;
dfs = (a, b, c) =>
{
if (a > b)
{
set.Add(c);
return;
}
dfs(a + 1, b, c + s[a]);
dfs(a, b - 1, c + s[b]);
};
dfs(0, s.Length - 1, "");
Console.WriteLine(set.Count);
}
#region Scan
static int ri() { return int.Parse(Console.ReadLine().Trim()); }
static long rl() { return long.Parse(Console.ReadLine().Trim()); }
static double rd() { return double.Parse(Console.ReadLine().Trim()); }
static string rs() { return Console.ReadLine().Trim(); }
static int[] ria() { return Console.ReadLine().Trim().Split().Select(int.Parse).ToArray(); }
static long[] rla() { return Console.ReadLine().Trim().Split().Select(long.Parse).ToArray(); }
static double[] rda() { return Console.ReadLine().Trim().Split().Select(double.Parse).ToArray(); }
static string[] rsa() { return Console.ReadLine().Trim().Split(); }
static void mul(out int a, out int b) { var arr = ria(); a = arr[0]; b = arr[1]; }
static void mul(out int a, out int b, out int c) { var arr = ria(); a = arr[0]; b = arr[1]; c = arr[2]; }
static void mul(out int a, out int b, out int c, out int d) { var arr = ria(); a = arr[0]; b = arr[1]; c = arr[2]; d = arr[3]; }
static void mul(out long a, out long b) { var arr = rla(); a = arr[0]; b = arr[1]; }
static void mul(out long a, out long b, out long c) { var arr = rla(); a = arr[0]; b = arr[1]; c = arr[2]; }
static void mul(out long a, out long b, out long c, out long d) { var arr = rla(); a = arr[0]; b = arr[1]; c = arr[2]; d = arr[3]; }
#endregion
#region Math
const int mod = 1000000007;
static bool isprime(long n){ if (n < 2) return false; for (long i = 2; i * i <= n; i++) if (n % i == 0) return false; return true; }
static long gcd(long a, long b) { return a == 0 ? b : gcd(b % a, a); }
static long lcm(long a, long b) { return a * b / gcd(a, b); }
#endregion
}
しらゆき