Дата активности | Видеокурс | Прогресс | ||
---|---|---|---|---|
2020-06-06 | game0 | Демо игры | 30 % | |
2020-06-04 | start | Начало здесь | % | |
Итого: | 22 % |
Дата активности | Консольный раздел | Прогресс | ||
---|---|---|---|---|
2020-10-08 | book | 111. Потоки | 13 % | |
2020-10-08 | book | 110. Функции | 100 % | |
2020-10-06 | base | Футбольная База | % | |
2020-10-06 | book | 100. Массивы | 100 % | |
2020-10-06 | book | 011. Циклы | 100 % | |
2020-10-06 | book | 101. Математика | 115 % | |
2020-04-10 | book | 010. Условия | 100 % | |
2020-04-08 | book | 000. Строки | 100 % | |
2020-04-08 | book | 001. Числа | 100 % | |
Итого: | 93 % |
Решил вот так, но бот не хочет воспринимать.
using System;
using System.Collections.Generic;
namespace MillionExercises
{
class Program
{
static void Main()
{
List<double[]> points = new List<double[]>();
double sumLength = 0;
for (int i = 0; i < 5; i++)
{
points.Add(Array.ConvertAll(Console.ReadLine().Split(), double.Parse));
}
sumLength += AddToLength(points[0], points[2]);
sumLength += AddToLength(points[0], points[3]);
sumLength += AddToLength(points[1], points[3]);
sumLength += AddToLength(points[1], points[4]);
sumLength += AddToLength(points[2], points[4]);
Console.WriteLine("{0:f3}", sumLength);
double AddToLength(double[] point1, double[] point2)
{
double sum;
sum = Math.Sqrt(Math.Pow(point2[0] - point1[0], 2) + Math.Pow(point2[1] - point1[1], 2));
return sum;
}
}
}
}
Бот число проверяет как строку?
Вывод Console.WriteLine("{0:f4}", square) и Console.WriteLine("{0:N4}",square) дают разные результаты, хотя по факту, и там и там число.
int count = int.Parse(Console.ReadLine());
int[] array = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
int min = array[0];
int max = array[0];
int minIndex = 0;
int maxIndex = 0;
for (int i = 0; i < count; i++)
{
if (array[i] > max)
{
max = array[i];
maxIndex = i;
}
else if (array[i] < min)
{
min = array[i];
minIndex = i;
}
}
array[minIndex] = max;
array[maxIndex] = min;
for (int i = 0; i < count; i++)
{
Console.Write(array[i] + " ");
}
Console.WriteLine();
Да, либо в условии ошибка, либо в боте. Работает именно с xi < N;
string[] xN = Console.ReadLine().Split(' ');
int x = Int32.Parse(xN[0]);
int N = Int32.Parse(xN[1]);
int i = 1;
int num = 0;
while (Math.Pow(x, i) < N)
{
num += (Int32)Math.Pow(x, i);
i++;
}
Console.WriteLine(num);
string line = Console.ReadLine();
int sum = 0;
int i = 0;
while (i < line.Length)
{
sum += Int32.Parse(line.Substring(i, 1));
i++;
}
Console.WriteLine(sum);
string num = Console.ReadLine();
num = num.TrimStart('0');
int[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
int count = 0;
for (int i = 0; i < arr.Length; i++)
{
for (int j = 0; j < num.Length; j++)
{
if (Int32.Parse(num.Substring(j, 1)) == arr[i])
{
count += 1;
}
}
}
Console.WriteLine(count);
int num = Int32.Parse(Console.ReadLine());
int count = 0;
string line = "";
while (count < num)
{
line += ":)";
count++;
}
Console.WriteLine(line);
int num = Int32.Parse(Console.ReadLine());
if (num % 2 == 0 && (num > 0 && num < 100))
Console.WriteLine("YES");
else
Console.WriteLine("NO");
string[] line = (Console.ReadLine().Split(' '));
int sum = 0;
int i = 0;
while (i < line.Length)
{
if (Int32.Parse(line[i]) > 0)
{
sum += Int32.Parse(line[i]);
}
i++;
}
Console.WriteLine(sum);
string line = Console.ReadLine();
int at = line.IndexOf("(") + 1;
int wordLength = line.IndexOf(")") - at;
Console.WriteLine(line.Substring(at, wordLength));