Дата активности | Консольный раздел | Прогресс | ||
---|---|---|---|---|
2016-07-13 | olimp | Олимпиада | 15 % | |
2016-07-13 | task2 | Алгоритмика | 100 % | |
2015-03-15 | task1 | Целые числа | 72 % | |
2015-01-25 | task1 | Строки | 100 % | |
2015-01-21 | task1 | Семантика | 100 % | |
Итого: | 59 % |
string [] s = Console.ReadLine().Split();
double x = double.Parse(s[0]);
double y = double.Parse(s[1]);
if(x>=0)
{
if(y>=0)
{
if(x*x+y*y<=4)
Console.WriteLine("YES");
else
Console.WriteLine("NO");
}
}
if(x<0)
{
if(x>=-2)
{
if(y>=0)
{
if(y<=2)
Console.WriteLine("YES");
else
Console.WriteLine("NO");
}
}
}
string s1 = Console.ReadLine();
string s2 = Console.ReadLine();
string [] a = s1.Split(' ');
int n = int.Parse(a[0]);
int t = int.Parse(a[1]);
string [] b = s2.Split(' ');
int [] ost = new int[t];
int count1 = 0;
int count2 = 0;
int sum = 0;
int zztop = 0;
int rat = 0;
if(n==1)
count1 = count1 + 1;
for(int i=0; i<t; i++)
{
ost[i] = int.Parse(b[i]);
if(ost[i]==1)
count1 = count1 + 1;
if(ost[i]==20)
count2 = count2 + 1;
}
if(count1>0 && count2>0)
Console.WriteLine("YES");
else
Console.WriteLine("NO");
for(int i=0; i<t - 1; i++)
{
if(ost[i]>ost[i+ 1])
sum = sum + (ost[i]-ost[i+ 1]);
else
sum = sum + (ost[i+ 1]-ost[i]);
if(ost[i]==1)
zztop = zztop + 1;
if(ost[i]==20 && zztop>0)
break;
}
if(ost[t]==20)
sum = sum + (ost[t]-ost[t- 1]);
Console.WriteLine(sum);