Az alábbi letöltési lehetőségek közül választhatsz: (
segítség)
Típus: text/plain
Tartalmaz szöveget
Karakterkódolás: us-ascii
Méret: 904 byte
using System;
using System.IO;
namespace prog_110208
{
class Program
{
public static int Min(int a, int b)
{
if(a<b){return a;} else {return b;}
}
public static void Main(string[] args)
{
StreamReader sr = new StreamReader("wcS.in");
int t = int.Parse(sr.ReadLine());
for(int z=0;z<t;z++)
{
int ford = int.Parse(sr.ReadLine());
int[] m = new int[Convert.ToInt32(Math.Pow(2,ford))];
string s = sr.ReadLine();
string[] s2 = s.Split(' ');
for(int a=0;a<m.Length;a++)
{
m[a]=int.Parse(s2[a]);
}
int jegy=0;
for(int a=0;a<ford;a++)
{
sr.ReadLine();
}
for(int a=0;a<ford;a++)
{
for(int b=0;b<m.Length/(Convert.ToInt32(Math.Pow(2,a+1)));b++)
{
int c = Min(m[b*2],m[(b*2)+1]);
if(c<=0)
{
jegy++;
}
m[b]=c-1;
}
}
Console.WriteLine("Case #" + (z+1) + ": " + jegy);
}
Console.ReadKey(true);
}
}
}