[ACM]Q10223: How many nodes ?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;
namespace Q10223
{
class Program
{
static private int n; static private bool ntof; static private BigInteger[] bi;
static void Main(string[] args)
{
for (; ; )
{
labeln: Console.Write("n>>>");
ntof = int.TryParse(Console.ReadLine(), out n);
if (!ntof || n <= 0) goto labeln;
if (n == 1) { Console.WriteLine("Ans=1"); goto labeln; }
bi = new BigInteger[n + 1]; bi[0] = 1;
for (int i = 1; bi[i - 1] <= n; i++)
{
bi[i] = bi[i - 1] * (4 * i - 2) / (i + 1);
if(bi[i]==n)Console.WriteLine("Ans={0}",i);
}
}
}
}
}