Дата активности | Консольный раздел | Прогресс | ||
---|---|---|---|---|
2022-04-15 | task1 | Строки | 93 % | |
2021-12-19 | book | Экзамен | % | |
2021-12-16 | book | 111. Потоки | 100 % | |
2021-11-24 | task1 | Целые числа | 100 % | |
2021-11-17 | book | 110. Функции | 100 % | |
2021-11-07 | book | 101. Математика | 115 % | |
2021-11-05 | book | 100. Массивы | 100 % | |
2021-10-27 | book | 011. Циклы | 100 % | |
2021-10-17 | book | 010. Условия | 100 % | |
2021-10-14 | task1 | Семантика | 100 % | |
2021-10-14 | book | 001. Числа | 100 % | |
2021-07-29 | book | 000. Строки | 100 % | |
Итого: | 109 % |
Круто. Твой код добавляет возможность искать сразу несколько слов в скобках. Я лишь добавил строку, которая разделяет эти слова пробелом))
s2 = s2 + " ";
в цикл
if (s1[i] == ')')
dot[i] = new Dot(coordinate[0], coordinate[1]);
что это?
Здарова!Смотрю ты шариш норм, Володя помоги а???!В Visual studio все работает а у РобоШарка нет((
www.videosharp.info/console/task/level=1635
Заранее Благодарен!
static void Main(string[] args)
{
Stream input = Console.OpenStandardInput();
int current;
int past = 0;
while (true)
{
current = input.ReadByte();
if (current == -1)
{
if (isNumber(past)) Console.Write("\"");
break;
}
if (isNumber(current) && !isNumber(past) || !isNumber(current) && isNumber(past))
Console.Write("\"");
Console.Write(Convert.ToChar(current));
past = current;
}
Console.WriteLine();
}
static bool isNumber(int x)
{
return (x >= '0' && x <= '9') ? true : false;
}
using System;
using System.Collections.Generic;
class VideoSharp
{
static void Main(string[] args)
{
List<long> n = new List<long>();
for (int i = 0; i < 3; i++)
{
n.AddRange(Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt64));
}
long numerator = n[0] * n[3] * n[5] + n[2] * n[1] * n[5] + n[4] * n[1] * n[3];
long denominator = n[1] * n[3] * n[5];
Console.WriteLine(numerator / NOD(numerator, denominator) + " " + denominator / NOD(numerator, denominator));
}
static long NOD(long a, long b)
{
while (true)
{
if (a == 0 || a == b)
{
return b;
}
else if (b == 0)
{
return a;
}
else if (a > b)
{
a %= b;
}
else
{
b %= a;
}
}
}
static long NOK(long a, long b)
{
return a * b / NOD(a, b);
}
static long NOK(long a, long b, long c)
{
return NOK(NOK(a, b), c);
}
}
using System;
using System.Collections.Generic;
class VideoSharp
{
static void Main(string[] args)
{
List<long> n = new List<long>();
for (int i = 0; i < 3; i++)
{
n.AddRange(Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt64));
}
long denominator = NOK(n[1], n[3], n[5]);
long numerator = n[0] * denominator / n[1] + n[2] * denominator / n[3] + n[4] * denominator / n[5];
Console.WriteLine(numerator / NOD(numerator, denominator) + " " + denominator / NOD(numerator, denominator));
}
static long NOD(long a, long b)
{
if (a % b == 0 || a == b) return b;
else if (a > b) return NOD(a - b, b);
else return NOD(b - a, a);
}
static long NOK(long a, long b)
{
return Math.Abs(a * b) / NOD(a, b);
}
static long NOK(long a, long b, long c)
{
return NOK(NOK(a, b), c);
}
}
using System;
class Program
{
static void Main(string[] args)
{
Dot A = new Dot();
A.Read();
Dot B = new Dot();
B.Read();
Dot C = new Dot();
C.Read();
Triangle triangle = new Triangle() { A = A, B = B, C = C };
Console.WriteLine("{0:N4}", triangle.Square());
}
}
struct Dot
{
public double X { get; set; }
public double Y { get; set; }
public void Read()
{
double[] coordinats = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToDouble);
X = coordinats[0];
Y = coordinats[1];
}
}
struct Triangle
{
public Dot A { get; set; }
public Dot B { get; set; }
public Dot C { get; set; }
public double Square()
{
double a = Math.Sqrt((C.X - B.X) * (C.X - B.X) + (C.Y - B.Y) * (C.Y - B.Y));
double b = Math.Sqrt((A.X - C.X) * (A.X - C.X) + (A.Y - C.Y) * (A.Y - C.Y));
double c = Math.Sqrt((B.X - A.X) * (B.X - A.X) + (B.Y - A.Y) * (B.Y - A.Y));
double p = (a + b + c) / 2;
return Math.Sqrt(p * (p - a) * (p - b) * (p - c));
}
}
int N = int.Parse(Console.ReadLine());
List<int> R = new List<int>();
for (int i = 2; i <= N; i++)
{
R.Add(i);
}
for (int i = 0; i < R.Count; i++)
{
for (int j = i + 1; j < R.Count; j++)
{
if (R[j] % R[i] == 0)
{
R.Remove(R[j]);
}
}
}
foreach (var item in R)
{
Console.WriteLine(item);
}
static void Main()
{
long number = long.Parse(Console.ReadLine());
while (number > 9)
number = Foo(number);
Console.WriteLine(number);
}
static long Foo(long number)
{
long newNum = 0;
while (number > 0)
{
newNum += number % 10;
number = number / 10;
}
return newNum;
}
int x;
Stream input = Console.OpenStandardInput();
List<int> numerals = new List<int>();
while ((x = input.ReadByte()) != -1)
{
numerals.Add(x);
if (numerals.Count == 3)
{
if (numerals[0] < numerals[1] && numerals[1] < numerals[2])
Console.Write((char)numerals[1]);
numerals.RemoveAt(0);
}
}
Console.WriteLine();
using System;
using System.IO;
using System.Collections.Generic;
class VideoSharp
{
static void Main()
{
int x = 0, sum = 0;
Stream input = Console.OpenStandardInput();
List<int> numerals = new List<int>();
while ((x = input.ReadByte()) != -1)
{
numerals.Add(x);
sum += x;
if (numerals.Count == 3)
{
Console.WriteLine(sum);
sum -= numerals[0];
numerals.RemoveAt(0);
}
}
}
}
Stream stream = Console.OpenStandardInput();
int[] wordVoid = { 118, 111, 105, 100 };
int i = 0;
int count = 0;
bool isSearch = false;
while (true)
{
int x = stream.ReadByte();
if (x == -1 || x == '0') break;
if (x == 118 && !isSearch) isSearch = true;
if (isSearch)
{
if (x == wordVoid[i])
{
if (i == wordVoid.Length - 1)
{
count++;
i = 0;
}
else
i++;
}
else
{
isSearch = false;
i = 0;
}
}
}
Console.WriteLine(count);
int min = 0, max = 0;
bool isFirstByte = true;
Stream stream = Console.OpenStandardInput();
while (true)
{
int x = stream.ReadByte();
if (x == -1 || x == 0)
{
break;
}
else if (isFirstByte)
{
min = x;
max = x;
isFirstByte = !isFirstByte;
}
else
{
min = x < min ? x : min;
max = x > max ? x : max;
}
}
Console.WriteLine(min + " " + max);
string s = Console.ReadLine();
s = s.Replace('A', '~').Replace('O', 'A').Replace('~', 'O');
s = s.Replace('a', '~').Replace('o', 'a').Replace('~', 'o');
Console.WriteLine(s);
string[] s = new string[7];
for (int i = 0; i < 7; i++)
s[i] = Console.ReadLine();
for (int i = 0; i < 7; i++)
Console.WriteLine(s[i].PadRight(8) + s[i].PadLeft(8));
string s = Console.ReadLine();
string sub = Console.ReadLine();
int index1 = s.IndexOf('(');
int index2 = s.IndexOf(')');
s = s.Remove(index1 + 1, index2 - index1 - 1);
s = s.Insert(index1 + 1, sub);
Console.WriteLine(s);
string[] subs = Console.ReadLine().Split(); foreach (var sub in subs) Console.WriteLine(sub);
static long NOD(long a, long b)
{
if (a % b == 0) return b;
else if (a == b) return a;
else if (a > b) return NOD(a - b, b);
else return NOD(b - a, a);
}
static void Main()
{
long a = long.Parse(Console.ReadLine());
long b = long.Parse(Console.ReadLine());
Console.WriteLine(NOD(a, b));
}
static long Fib(long number, long currentDigit = 1, long previousDigit = 0)
{
if (number == 1)
{
return currentDigit;
}
else
{
number--;
long newDigit = currentDigit + previousDigit;
return Fib(number, newDigit, currentDigit);
}
}
static void Main()
{
long number = long.Parse(Console.ReadLine());
Console.WriteLine(Fib(number));
}
static long Factor(long n)
{
if (n == 0) return 1;
else return n * Factor(n - 1);
}
static void Main()
{
byte n = byte.Parse(Console.ReadLine());
Console.WriteLine(Factor(n));
}
const int NUMBEROFDOTS = 5;
class Dot
{
public double X { get; set; }
public double Y { get; set; }
public Dot(double x, double y)
{
X = x;
Y = y;
}
}
static double Distance(Dot a, Dot b)
{
double distance = Math.Sqrt(Math.Pow(a.X - b.X, 2) + Math.Pow(a.Y - b.Y, 2));
return distance;
}
static void Main(string[] args)
{
Dot[] dot = new Dot[NUMBEROFDOTS];
for (int i = 0; i < NUMBEROFDOTS; i++)
{
double[] coordinate = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToDouble);
dot[i] = new Dot(coordinate[0], coordinate[1]);
}
double AC = Distance(dot[0], dot[2]);
double AD = Distance(dot[0], dot[3]);
double BD = Distance(dot[1], dot[3]);
double BE = Distance(dot[1], dot[4]);
double CE = Distance(dot[2], dot[4]);
Console.WriteLine("{0:N2}", AC + AD + BD + BE + CE);
}
static bool isTriangle(int a, int b, int c)
{
if (a + b > c && a + c > b && b + c > a) return true;
else return false;
}
static void Main(string[] args)
{
int[] a = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);
int n = 0;
for (int i = 0; i < a.Length; i++)
for (int j = i + 1; j < a.Length; j++)
for (int k = j + 1; k < a.Length; k++)
if (isTriangle(a[i], a[j], a[k]))
n++;
Console.WriteLine(n);
}
//www.VideoSharp.info/Консоль/110. Функции/Минимум и максимум
using System;
class VideoSharp
{
static int FindMax(int a, int b)
{
int result = a > b ? a : b;
return result;
}
static int FindMin(int a, int b)
{
int result = a < b ? a : b;
return result;
}
static void Main()
{
Console.ReadLine();
int[] array = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);
int min = array[0];
int max = array[0];
foreach (var item in array)
{
min = FindMin(min, item);
max = FindMax(max, item);
}
Console.WriteLine("{0} {1}", min, max);
}
}
Почему робот постоянно медитирует? Я не могу пройти дальше, код написан исправно
string[] a1 = Console.ReadLine().Split();
string[] a2 = Console.ReadLine().Split();
string[] a3 = Console.ReadLine().Split();
string[] a4 = Console.ReadLine().Split();
string[] a5 = Console.ReadLine().Split();
int b1 = int.Parse(a1[a1.Length - 1]);
int b2 = int.Parse(a2[a2.Length - 1]);
int b3 = int.Parse(a3[a3.Length - 1]);
int b4 = int.Parse(a4[a4.Length - 1]);
int b5 = int.Parse(a5[a5.Length - 1]);
Console.WriteLine(b1 + " " + b2 + " " + b3 + " " + b4 + " " + b5);
Console.WriteLine(b1 + b2 + b3 + b4 + b5);
long a = long.Parse(Console.ReadLine());
long b = long.Parse(Console.ReadLine());
Console.WriteLine("{0} / {1} = {2}", a, b, a / b);
Console.WriteLine("{0} % {1} = {2}", a, b, a % b);
int[] a = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);
int sum = 0;
foreach (var item in a)
sum += item;
Console.WriteLine(sum);
Console.ReadLine();
int[] a = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);
Console.WriteLine("{0} {1}", a.Min(), a.Max());
double y, z, num, den;
y = double.Parse(Console.ReadLine());
for (double x = -0.5; x <= 0.5; x += 0.1)
{
num = 1 + Math.Pow(Math.Cos(x + y), 2);
den = 2 + Math.Abs(y - Math.Sin(x));
z = num / den;
Console.WriteLine("{0:N5}", z);
}
static void Main()
{
int N = int.Parse(Console.ReadLine());
double result = 0;
for (int i = 1; i <= N; i++)
{
result = Math.Sqrt(i + result);
}
Console.WriteLine("{0:N5}", result);
}
byte N = byte.Parse(Console.ReadLine());
double result = 6561;
for(byte i = 0; i < N; i++)
{
result = Math.Sqrt(result);
}
Console.WriteLine("{0:N4}", result);
int[] a = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);
double d = a[1] * a[1] - 4 * a[0] * a[2];
if (d < 0)
{
Console.WriteLine("NO");
}
else if (d == 0)
{
double result = -a[1] / (2 * a[0]);
Console.WriteLine("{0:0.000}", result);
}
else if (d > 0)
{
double result1 = (-a[1] + Math.Sqrt(d)) / (2 * a[0]);
double result2 = (-a[1] - Math.Sqrt(d)) / (2 * a[0]);
if (result1 < result2) Console.WriteLine("{0:0.000} {1:0.000}", result1, result2);
else Console.WriteLine("{0:0.000} {1:0.000}", result2, result1);
}
Console.ReadLine();
int[] a = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);
byte j = 0;
for(int i = 0; i< a.Length; i++)
if (a[i] == 0) j++;
Console.WriteLine(j);
Console.ReadLine();
int[] a = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);
int max = a[0];
int min = a[0];
for (int i = 1; i < a.Length; i++)
{
if (max < a[i]) max = a[i];
if (min > a[i]) min = a[i];
}
Console.WriteLine("{0} {1}", min, max);
Console.ReadLine();
int[] a = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);
for (int i = 0; i < a.Length; i++)
{
if (i % 2 == 0)
Console.Write("{0} ", a[i] * a[i]);
else
Console.Write("{0} ", 2 * a[i]);
}
Console.WriteLine();
int N = int.Parse(Console.ReadLine());
string[] input = Console.ReadLine().Split();
int[] a = new int[N];
for (int i = 0; i < N; i++)
{
a[i] = int.Parse(input[i]);
}
for (int i = 0; i < N; i++)
a[i]++;
for (int i = 0; i < N - 1; i++)
Console.Write("{0},", a[i]);
Console.Write("{0}.", a[N - 1]);
Console.WriteLine();
Возьмите меня на роботу программистом
int N = int.Parse(Console.ReadLine());
int[] a = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);
Console.WriteLine("{0} {1}", a[0], a[N - 1]);
long [] n = Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt64);
long result = 1;
for(int i = 0; i < n[1]; i++)
result *= n[0];
Console.WriteLine(result);
string s = Console.ReadLine();
int sum = 0;
int i = 0;
while (i < s.Length)
{
sum += s[i] - '0';
i++;
}
Console.WriteLine(sum);
long number = long.Parse(Console.ReadLine());
byte digits = 0;
do
{
number /= 10;
digits++;
}
while (number != 0);
Console.WriteLine(digits);
ulong a = ulong.Parse(Console.ReadLine());
if (a > 9 && a < 100 && a % 2 == 0)
Console.WriteLine("YES");
else
Console.WriteLine("NO");
long[] num = Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), Convert.ToInt64);
long bubble = num[0];
for (int j = 0; j < num.Length - 1; j++){
for (int i = 0; i < num.Length - 1; i++)
{
if (num[i] > num[i + 1])
{
bubble = num[i];
num[i] = num[i+1];
num[i+1] = bubble;
}
}}
for (int i = 0; i < num.Length; i++)
{
Console.WriteLine(num[i]);
}
long[] num = Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), Convert.ToInt64);
Array.Sort(num);
if (true)
{
for (int i = 0; i < num.Length; i++)
{
Console.WriteLine(num[i]);
}
}
//www.VideoSharp.info/Консоль/010. Условия/Минимальное расстояние
using System;
class VideoSharp
{
static void Main()
{
long[] num = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt64);
long a1 = num[0] - num[1] > 0 ? num[0] - num[1] : num[1] - num[0];
long a2 = num[1] - num[2] > 0 ? num[1] - num[2] : num[2] - num[1];
long a3 = num[2] - num[3] > 0 ? num[2] - num[3] : num[3] - num[2];
long a4 = num[3] - num[0] > 0 ? num[3] - num[0] : num[0] - num[3];
long min = a1;
if (min > a2) min = a2;
if (min > a3) min = a3;
if (min > a4) min = a4;
Console.WriteLine(min);
}
}
//www.VideoSharp.info/Консоль/010. Условия/Модуль
using System;
class VideoSharp
{
static void Main()
{
long number = long.Parse(Console.ReadLine());
if (number < 0)
number = -number;
Console.WriteLine(number);
}
}
//www.VideoSharp.info/Консоль/010. Условия/Максимум
using System;
class VideoSharp
{
static void Main()
{
int a = int.Parse(Console.ReadLine());
int b = int.Parse(Console.ReadLine());
if (a > b) Console.WriteLine(a);
else Console.WriteLine(b);
int max = a > b ? a : b;
Console.WriteLine(max);
}
}
class VideoSharp
{
static void WriteSymbol(int i = 0)
{
if (i >= 1000) return;
Console.Write("#");
i++;
WriteSymbol(i);
}
static void Main()
{
WriteSymbol();
Console.WriteLine();
}
}
using System;
class VideoSharp
{
static void Main()
{
int n = int.Parse(Console.ReadLine());
Console.WriteLine("{0} {1} {2} {3} {4}", n, ++n, ++n, ++n, ++n);
Console.WriteLine("{0} {1} {2} {3} {4}", n, --n, --n, --n, --n);
}
}
string number = Console.ReadLine();
Console.WriteLine(number);
Console.WriteLine(number.PadLeft(5, '0'));
Console.WriteLine(number.PadLeft(5));
//www.VideoSharp.info/Консоль/001. Числа/Чтение
using System;
class VideoSharp
{
static void Main()
{
long a = Convert.ToInt64(Console.ReadLine()) + 1;
long b = Int64.Parse(Console.ReadLine()) + 1;
long c;
Int64.TryParse(Console.ReadLine(), out c);
Console.WriteLine(a + " " + b + " " + ++c);
}
}
using System;
class VideoSharp
{
static void Main()
{
string text = Console.ReadLine();
string subText = text.Substring(1, text.Length - 2);
Console.WriteLine(text[0] + subText.TrimStart() + text[text.Length - 1]);
Console.WriteLine(text[0] + subText.TrimEnd() + text[text.Length - 1]);
Console.WriteLine(text[0] + subText.Trim() + text[text.Length - 1]);
}
}
using System;
class VideoSharp
{
static void Main()
{
string text = Console.ReadLine();
string word = Console.ReadLine();
text = text.Insert(text.IndexOf(' ') + 1, word + " ");
Console.WriteLine(text);
}
}
//www.VideoSharp.info/Консоль/000. Строки/Длинное слово
using System;
class VideoSharp
{
static void Main()
{
string s1 = Console.ReadLine();
string[] words = new string[NumberOfWords(s1)];
int maxLength = 0;
for (int i = 0; i < NumberOfWords(s1); i++)
{
words[i] = "";
}
FillWords(words, s1);
for (int i = 0; i < NumberOfWords(s1); i++)
{
if (Length(words[i]) > maxLength)
{
maxLength = Length(words[i]);
}
}
Console.WriteLine(maxLength);
}
static int NumberOfWords(string s)
{
int numberOfWords = 0;
for (int i = 0; i < s.Length; i++)
{
if (isEndOfWord(s, i))
{
numberOfWords++;
}
}
return numberOfWords;
}
static void FillWords(string[] words, string s)
{
int j = 0;
for (int i = 0; i < s.Length; i++)
{
if (s[i] != ' ')
{
words[j] = words[j] + s[i];
}
if (isEndOfWord(s, i)) j++;
}
}
static bool isEndOfWord(string s, int i)
{
bool isEndOfWord = false;
if (s[i] != ' ' && i + 1 < s.Length)
{
if (s[i + 1] == ' ')
isEndOfWord = true;
}
else if (s[i] != ' ' && i + 1 == s.Length)
{
isEndOfWord = true;
}
else isEndOfWord = false;
return isEndOfWord;
}
static int Length(string word)
{
if (word[word.Length - 1] == '.' || word[word.Length - 1] == ',' ||
word[word.Length - 1] == '!' || word[word.Length - 1] == '?' )
{
return word.Length - 1;
}
else return word.Length;
}
}
//www.VideoSharp.info/Консоль/000. Строки/Подстрока
using System;
class VideoSharp
{
static void Main()
{
string s1 = Console.ReadLine();
string s2 = "";
bool inBrack = false;
for (int i = 0; i < s1.Length; i++)
{
if (s1[i] == ')')
{
inBrack = false;
}
if (inBrack)
{
s2 = s2 + s1[i];
}
if (s1[i] == '(')
{
inBrack = true;
}
}
Console.WriteLine(s2);
}
}