decimal num = decimal.Parse(Console.ReadLine());
int res=0;
do
{
num = Math.Floor(num / 10);
res++;
}
while (num > 0);
Console.WriteLine(res);
Сегодня же суббота я твой отчет увидел и у меня на куче стал искаться метод для открывания стандартного календаря =)
int a = int.Parse(Console.ReadLine());
int b = int.Parse(Console.ReadLine());
while (a<b)
{
Console.Write("{0},",a);
a++;
}
Console.WriteLine("{0}.", b);
Подписка в Клуб формулистов обновлена.
Количество дней: +30
Количество байт: +256
Подписка КФ до: 2020-06-10
Остаток байтов: 636
Вы являетесь участником Клуба формулистов.
string num1 = Console.ReadLine();
string num2 = Console.ReadLine();
if ((Convert.ToInt32(num1[num1.Length - 1]) == Convert.ToInt32(num2[num2.Length - 1])))
Console.WriteLine("YES");
else Console.WriteLine("NO");
Пришлось помучиться. Нужно правильно оценивать задание чтобы не упустить ничего!
В разделе Видеокурсы Другие www.videosharp.info/video/webinar/nr=2247 www.videosharp.info/video/github
Анатолий, спасибо за совет. Можешь дать ссылки на эти курсы и вебинар? Не могу найти.
Спасибо!
Ребят Денис, Дмитрий пройдите курс по гит, он есть в вебинарах и еще есть отдельный курс. На курсе уже все четче и еще лучше объяснено. В гите все это есть, перед важным изменением делается слепок кода и сохраняется. И потом этот слепок можно вернуть, отдельно рассмотреть, вобщем знакомтесь с гитом и все изменения что были зафиксированы, можно будет снова увидеть и изучить.
Да Дима согласен с твоим комментарием. Еще от себя добавлю что немного надо теории добавлять в материал, хотя бы в электронной форме, что бы была возможность подтянуть знания. Сам прохожу весь этот путь и в начале изучаю теорию а потом оставляю время на один урок для закрепления материала, так вроде более менее понятно становится. Тебе хорошего настроения и удачного прохождения уроков.
Stream str = Console.OpenStandardInput();
List<int> nums = new List<int>();
while (true)
{
int x = str.ReadByte();
if (x == -1) break; // CTRL Z
nums.Add(x);
}
for (int i = 1; i < nums.Count - 1; i++)
{
if (((nums[i-1]) < (nums[i])) && ((nums[i]) < (nums[i+1])))
{
Console.Write((char)nums[i]);
}
}
Console.WriteLine();
Stream str = Console.OpenStandardInput();
List<int> nums = new List<int>();
while (true)
{
int x = str.ReadByte();
if (x == -1) break; // CTRL Z
nums.Add(x);
}
for (int i = 0; i < nums.Count - 2; i++)
{
int sum = nums[i] + nums[i + 1] + nums[i + 2];
Console.WriteLine(sum);
}
А, понял. Для Робота признаком конца потока должен служить CTRL Z а не Enter
А я замутил с List
Тоже работает, но Робот не пропускает
int count = 0;
string comp = "118111105100";
Stream str = Console.OpenStandardInput();
List<int> firstlist = new List<int>();
List<string> secondlist = new List<string>();
while (true)
{
int x = str.ReadByte();
if (x == 13) // ENTER
{
string res = null;
foreach (var item in firstlist)
if (item != 32)
{
res += Convert.ToString(item);
}
firstlist.Clear();
secondlist.Add(res);
break;
}
if (x == 32) //SPACE
{
string res = null;
foreach (var item in firstlist)
{
if (item != 32)
{
res += Convert.ToString(item);
}
}
firstlist.Clear();
secondlist.Add(res);
}
firstlist.Add(x);
}
foreach (var item in secondlist)
{
if (item == comp) count++;
}
Console.WriteLine("{0}", count);
Вроде получилось сразу
double count = 0;
double res = 0;
double sum = 0;
Stream str = Console.OpenStandardInput();
while (true)
{
int x = str.ReadByte();
if (x == -1)
{
res = Convert.ToDouble(sum) / count;
break;
}
if (x == 0)
{
res = 0;
break;
}
sum = sum + x;
count++;
}
Console.WriteLine("{0:0.000}",res);
using System;
namespace SquareCalc
{
class Program
{
static void Main(string[] args)
{
var x1y1 = Console.ReadLine().Split();
var x2y2 = Console.ReadLine().Split();
Box box = new Box();
box.Calc(long.Parse(x1y1[0]), long.Parse(x1y1[1]), long.Parse(x2y2[0]), long.Parse(x2y2[1]));
}
}
class Box
{
public long x1, y1, x2, y2;
public long width;
public long height;
public void Calc(long x1, long y1, long x2, long y2)
{
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
this.y2 = y2;
this.width = Math.Abs(x1 - x2);
this.height = Math.Abs(y1 - y2);
Console.WriteLine(width * height);
Console.ReadLine();
}
}
}
int N = int.Parse(Console.ReadLine());
var nums = Console.ReadLine().Split();
int[] num = new int[N];
try
{
for (int i = 0; i < N; i++)
{
num[i] = int.Parse(nums[i]);
}
}
catch(IndexOutOfRangeException)
{
Console.WriteLine("Range Exception");
}
int minValue = num.Min();
int maxValue = num.Max();
int indexMin = Array.IndexOf(num, minValue);
int indexMax = Array.IndexOf(num, maxValue);
int temp;
temp = minValue;
num[indexMin] = num[indexMax];
num[indexMax] = temp;
foreach (var item in num)
{
Console.Write("{0} ",item);
}
Иногда такое бывает,тут безполезно, что-то выяснять, вероятно глючит робот шарпа. Приходиться, чтобы решить норму две задачи решать их в разделе Алгоритмика и Семантика.
string str = Console.ReadLine();
char[] chars = new char[str.Length];
int end = str.Length;
for (int i = 0; i < str.Length; i++)
{
chars[end-1] = str[i];
end--;
}
Console.WriteLine(chars);
Из всех трёхзначных чисел, выведи в столбик те, сумма цифр которых равна 7.
using System;
using System.Linq;
namespace Three_digits_nums
{
class Program
{
static void Main()
{
var result = Enumerable.Range(100, 900);
foreach (var r in result)
{
var Arr = (Convert.ToString(r));
if (((Convert.ToInt32(Arr[0]) - 48) + (Convert.ToInt32(Arr[1]) - 48) + (Convert.ToInt32(Arr[2]) - 48)) == 7) Console.WriteLine(Convert.ToInt32(r));
}
}
}
}
И что ему не нравится?
Ошибка при выполнении демо-теста:
НЕВЕРНЫЙ ОТВЕТ:
106
115
124
133
142
151
160
205
214
223
232
241
250
304
313
322
331
340
403
412
421
430
502
511
520
601
610
700
Робот Шарп: Найди, исправь ошибку и пробуй снова!
Капец как запутанно, мне немного помогает чтение теории по этому же направлению и если проходить в теории эти темы, а потом смотреть более понятно ход мысли получается.
static void Main()
{
int num = int.Parse(Console.ReadLine());
int ost = num;
int k = 0, k1 = 0;
var list = new List<int>();
if (num == 0) list.Add(num);
while (num >= 1)
{
ost = num % 2;
num = num / 2;
list.Add(ost);
}
for (int i = 0; i < list.Count; i++)
{
if (list[i] == 0) k++;
if (list[i] == 1) k1++;
}
Console.WriteLine("0 - {0}", k);
Console.WriteLine("1 - {0}", k1);
Console.ReadLine();
}
string line = Console.ReadLine();
int num = 0;
for (int i = 0; i < line.Length; i++)
{
if (line[i].Equals ('*'))
num++;
}
Console.WriteLine(num);
Интересно, а что в каком редакторе пишешь код?
Да Евгений Витольдович в этом преуспел, доволит до тупика, а после упрощает, так усваивается игформация, очень даже хорошо.
Блин, не могу понять как вычислить количество дней если ДР 29.02
Получается 171 день - говорит не верный ответ(((
var nums = Console.ReadLine().Split();
int month = int.Parse(nums[0]);
int year = int.Parse(nums[1]);
var date = new DateTime(year, month, 13);
int DoW = Convert.ToInt16(date.DayOfWeek);
Console.WriteLine((DoW==5)? "YES":"NO");
string chars = Console.ReadLine();
int k=0, k1=0, k2=0, k3=0, k4=0, k5=0, k6=0, k7=0, k8=0, k9 = 0;
for (int i = 0; i < chars.Length; i++)
{
if (chars[i] == '0') k++;
if (chars[i] == '1') k1++;
if (chars[i] == '2') k2++;
if (chars[i] == '3') k3++;
if (chars[i] == '4') k4++;
if (chars[i] == '5') k5++;
if (chars[i] == '6') k6++;
if (chars[i] == '7') k7++;
if (chars[i] == '8') k8++;
if (chars[i] == '9') k9++;
}
Console.WriteLine("0" + " - " + k);
Console.WriteLine("1" + " - " + k1);
Console.WriteLine("2" + " - " + k2);
Console.WriteLine("3" + " - " + k3);
Console.WriteLine("4" + " - " + k4);
Console.WriteLine("5" + " - " + k5);
Console.WriteLine("6" + " - " + k6);
Console.WriteLine("7" + " - " + k7);
Console.WriteLine("8" + " - " + k8);
Console.WriteLine("9" + " - " + k9);
в описании урока опечатка (Создаём новые классы для цветны линий, окружностей и прямоугольников. ) не хватает буквы х в слове цветных,
написал тебе, потому что на твоем отчете заметил это и не знаю куда писать, что бы исправили
Не пойму как заполнять еженедельный отчёт. По ссылке переходит на Дневник успеха.
(Накопленные байты будут засчитаны только тем, кто до конца недели заполнит еженедельный отчёт!)
Структура хранится на стеке, а класс - в куче.
Приветствую, Дмитрий! Смотрю по скриншоту используешь VS 2008, я думаю это правильный подход. Я до последнего на нем делал проекты. Здесь почти все курсы можно в VS 2008 реализовать.
Подписка в Клуб формулистов обновлена.
Количество дней: +40
Количество байт: +256
Подписка КФ до: 2020-05-11
Остаток байтов: 256
Вы являетесь участником Клуба формулистов.
Добрый день. Я оплатил подписку на Клуб Формулистов. Хотел бы пройти видеоурок Теория ООП, однако доступ к уроку №2 (Урок рисования) пока не открыт.
Дмитрий, diflex73@gmail.com
Console.WriteLine("{0:0.0000}", Math.PI * (Math.Pow(Convert.ToDouble(Console.ReadLine()), 2.0)));
int N = int.Parse(Console.ReadLine());
double res = 6561;
for (int i = 1; i <= N; i++)
{
res = Math.Sqrt(res);
}
Console.WriteLine("{0:N4}", res);
double a = float.Parse(Console.ReadLine());
double x = float.Parse(Console.ReadLine());
double z = (Math.Pow((Math.Pow(x, 3)), 1 / 4.0) + (a * x)) / (Math.Log(Math.Sqrt(Math.Pow(a, 2) + Math.Sqrt(x))));
Console.WriteLine("{0:N4}", z);
var nums = Console.ReadLine().Split();
double a = double.Parse(nums[0]);
double b = double.Parse(nums[1]);
double c = double.Parse(nums[2]);
double D = b * b - 4 * a * c;
double x1, x2;
x1 = (-b + Math.Sqrt(D)) / (2 * a);
x2 = (-b - Math.Sqrt(D)) / (2 * a);
if (D > 0)
{
if (x1 < x2)
{
Console.WriteLine("{0:N3} {1:N3}", x1, x2);
}
else Console.WriteLine("{0:N3} {1:N3}", x2, x1);
}
if (D < 0)
{
Console.WriteLine("NO");
}
if (D == 0)
{
Console.WriteLine("{0:N3}", x1);
}
int ArraySize = int.Parse(Console.ReadLine());
var arr = Console.ReadLine().Split();
int num = 0;
for (int i = 0; i < ArraySize; i++)
{
if (arr[i].Equals("0") || arr[i].Equals("-0"))
{
num++;
}
}
Console.WriteLine(num);
int ArraySize = int.Parse(Console.ReadLine());
var arr = Console.ReadLine().Split();
int min = int.Parse(arr[0]), max = int.Parse(arr[0]), minIndex = 0, maxIndex = 0;
for (int i = 0; i < ArraySize; i++)
{
int N = int.Parse(arr[i]);
if (N < min)
{
min = N;
minIndex = i;
}
if (N > max)
{
max = N;
maxIndex = i;
}
}
string temp = arr[minIndex];
arr[minIndex] = arr[maxIndex];
arr[maxIndex] = temp;
foreach (var item in arr)
{
Console.Write(item + " ");
}
Console.WriteLine();
int ArraySize = int.Parse(Console.ReadLine());
var arr = Console.ReadLine().Split();
int min = 0, max = 0;
for (int i = 0; i < ArraySize; i++)
{
int N = int.Parse(arr[i]);
if (N < min)
{
min = N;
}
if (N > max)
{
max = N;
}
}
Console.WriteLine("{0} {1}", min, max);
int ArraySize = int.Parse(Console.ReadLine());
var arr = Console.ReadLine().Split();
for (int i = 0; i < ArraySize; i++)
{
int N = int.Parse(arr[i]);
if (i%2!=0)
{
Console.Write("{0} ",N*2);
}
else Console.Write("{0} ", Math.Pow(N,2));
}
Console.WriteLine();
int ArraySize = int.Parse(Console.ReadLine());
var arr = Console.ReadLine().Split();
for (int i = 0; i < ArraySize; i++)
{
Console.Write("{0}", int.Parse(arr[i])+1);
if (i < ArraySize-1)
{
Console.Write(",");
}
else Console.Write(".");
}
Console.WriteLine();
int ArraySize = int.Parse(Console.ReadLine());
var arr = Console.ReadLine().Split();
for (int i = ArraySize-1; i >= 0; --i)
{
Console.Write("{0} ", arr[i]);
}
Console.WriteLine();
int ArraySize = int.Parse(Console.ReadLine());
var arr = Console.ReadLine().Split();
Console.WriteLine("{0} {1}", arr[0], arr[ArraySize-1]);
var len = Console.ReadLine().TrimStart('0').Length;
Console.WriteLine(len);
int num = int.Parse(Console.ReadLine());
int max=0;
for (int i = 1; i < num; i++)
{
while (num % i == 0)
{
max = i;
break;
}
}
Console.WriteLine(max);
int num = int.Parse(Console.ReadLine());
switch (num)
{
case (1): Console.WriteLine("понедельник");
break;
case (2): Console.WriteLine("вторник");
break;
case (3): Console.WriteLine("среда");
break;
case (4): Console.WriteLine("четверг");
break;
case (5): Console.WriteLine("пятница");
break;
case (6): Console.WriteLine("суббота");
break;
case (7): Console.WriteLine("воскресенье");
break;
}
var nums = Console.ReadLine().Split();
long a = long.Parse(nums[0]);
long b = long.Parse(nums[1]);
long c = long.Parse(nums[2]);
long d = long.Parse(nums[3]);
long dintance1 = a - b;
if (dintance1 < 0) dintance1 = -dintance1;
long dintance2 = b - c;
if (dintance2 < 0) dintance2 = -dintance2;
long dintance3 = c - d;
if (dintance3 < 0) dintance3 = -dintance3;
long dintance4 = d - a;
if (dintance4 < 0) dintance4 = -dintance4;
if (dintance1 < dintance2 && dintance1 < dintance3 && dintance1 < dintance4) Console.WriteLine(dintance1);
if (dintance2 < dintance1 && dintance2 < dintance3 && dintance2 < dintance4) Console.WriteLine(dintance2);
if (dintance3 < dintance2 && dintance3 < dintance1 && dintance3 < dintance4) Console.WriteLine(dintance3);
if (dintance4 < dintance2 && dintance4 < dintance3 && dintance4 < dintance1) Console.WriteLine(dintance4);
int Res = int.Parse(Console.ReadLine());
Console.WriteLine(Res);
Console.WriteLine("{0,0:d5}", Res);
Console.WriteLine("{0,5}", Res);
string input = Console.ReadLine();
string[] inp = input.Split(' ');
int firstnumber,secondnumber;
if (!Int32.TryParse(inp[0], out firstnumber))
{
Console.WriteLine("not number");
}
if (!Int32.TryParse(inp[1], out secondnumber))
{
Console.WriteLine("not number");
}
Console.WriteLine(firstnumber + secondnumber);
Console.WriteLine(firstnumber - secondnumber);
Console.WriteLine(firstnumber * secondnumber);
Console.WriteLine(firstnumber / secondnumber);
Console.WriteLine(firstnumber % secondnumber);
static void Main()
{
long First = Convert.ToInt64(Console.ReadLine());
string second = Console.ReadLine();
long Second = Int64.Parse(second);
string third = Console.ReadLine();
long Third;
if (!Int64.TryParse(third, out Third))
{
Console.WriteLine("not number");
}
Console.WriteLine("{0} {1} {2}", First+1,Second+1,Third+1);
}
static void Main()
{
string sentence = Console.ReadLine();
string start = sentence.TrimStart('[', ' ', '\t');
string end = sentence.TrimEnd(']', ' ', '\t');
string mid = sentence.Trim('[', ']', ' ', '\t');
Console.WriteLine("[{0}",start);
Console.WriteLine("{0}]", end);
Console.WriteLine("[{0}]", mid);
}
static void Main()
{
string sentence = Console.ReadLine();
string word = Console.ReadLine();
var newS = sentence.Insert(sentence.IndexOf(' ')+1, word + " ");
Console.WriteLine(newS);
}
string words = Console.ReadLine();
string[] wordsList = words.Split(' ', '.', ',', ':', ';', '?', '!', '-');
string temp = "";
for (int i = 0; i < wordsList.Length; i++)
{
if (temp.Length < wordsList[i].Length)
{
temp = wordsList[i];
}
}
Console.WriteLine(temp.Length);
class Program
{
static void Main(string[] args)
{
string Read = Console.ReadLine();
string splitChar = " ";
SplitMethod(Read, splitChar);
}
public static void SplitMethod(string Read, string splitChar)
{
string[] sTemp = Read.Split(splitChar[0]);
for (int i = 0; i < 5; i++)
{
Console.WriteLine(sTemp[i]);
}
Console.ReadLine();
}
}