Дата активности | Консольный раздел | Прогресс | ||
---|---|---|---|---|
2021-12-22 | task1 | Целые задачи | 100 % | |
2021-07-15 | task1 | Символы | 100 % | |
2021-07-15 | task1 | Геометрия | 100 % | |
2021-07-14 | solo | СОЛО на клавиатуре | % | |
2021-07-14 | task1 | Лирика | 93 % | |
2021-07-14 | task1 | Формулы | 100 % | |
2021-07-14 | task1 | Строки | 100 % | |
2021-02-23 | olimp | Олимпиада | 18 % | |
2021-02-18 | task2 | Типы данных | 100 % | |
2021-02-18 | task2 | VIP задачи | % | |
2021-02-18 | solo | YESOLO on the Keyboard | % | |
2021-02-10 | task2 | Условный оператор | 100 % | |
2021-02-10 | task2 | Логика | 100 % | |
2021-02-10 | task2 | Пока-цикл | 100 % | |
2021-02-10 | task2 | Вечность | 20 % | |
2021-02-10 | task2 | For-to-чки | 100 % | |
2021-01-28 | task2 | Алгоритмика | 100 % | |
2021-01-28 | task1 | Целые числа | 100 % | |
2021-01-26 | book | 001. Числа | 100 % | |
2021-01-26 | solo | Алфавит | % | |
2021-01-26 | book | 010. Условия | 88 % | |
2021-01-23 | solo | Java - Запуск | 8 % | |
2021-01-23 | book | 000. Строки | 100 % | |
2021-01-22 | task1 | Семантика | 100 % | |
Итого: | 86 % |
using System;
class VideoSharp
{
static void Main()
{
long A = long.Parse(Console.ReadLine());
Console.WriteLine(A * (int)(A / 5));
}
}
using System;
class VideoSharp
{
static void Main()
{
String[] data = Console.ReadLine().Split();
double x2 = double.Parse(data[1]) / double.Parse(data[0]);
Console.WriteLine("{0:f1} {1:f1}", x2, -double.Parse(data[0]) - x2);
}
}
using System;
class VideoSharp
{
static void Main()
{
String str = Console.ReadLine();
long A = long.Parse(str.Substring(0, str.IndexOf('+')));
long B = long.Parse(str.Substring(str.IndexOf('+') + 1, str.IndexOf('*') - str.IndexOf('+') - 1));
long C = long.Parse(str.Substring(str.IndexOf('*') + 1, str.IndexOf('=') - str.IndexOf('*') - 1));
Console.WriteLine(A + B * C);
}
}
using System;
class VideoSharp
{
static void Main()
{
double count = double.Parse(Console.ReadLine()) * 100;
Console.WriteLine(Math.Abs((int)count % 10));
}
}
using System;
class VideoSharp
{
static void Main()
{
String[] data = Console.ReadLine().Split();
Console.WriteLine(int.Parse(data[1]) * int.Parse(data[1]) - 4 * int.Parse(data[0]) * int.Parse(data[2]));
}
}
using System;
class VideoSharp
{
static void Main()
{
String[] data = Console.ReadLine().Split();
Console.WriteLine("{0:f2}", Math.Abs(float.Parse(data[0]) * float.Parse(data[1]) * 0.5f));
}
}
using System;
class VideoSharp
{
static void Main()
{
String[] A = Console.ReadLine().Split();
String[] B = Console.ReadLine().Split();
String[] C = Console.ReadLine().Split();
double AB = Math.Sqrt(Math.Pow(int.Parse(A[0]) - int.Parse(B[0]), 2) + Math.Pow(int.Parse(A[1]) - int.Parse(B[1]), 2));
double BC = Math.Sqrt(Math.Pow(int.Parse(B[0]) - int.Parse(C[0]), 2) + Math.Pow(int.Parse(B[1]) - int.Parse(C[1]), 2));
double AC = Math.Sqrt(Math.Pow(int.Parse(A[0]) - int.Parse(C[0]), 2) + Math.Pow(int.Parse(A[1]) - int.Parse(C[1]), 2));
Console.WriteLine("{0:f2}", AB + BC + AC);
}
}
Мда, условие, конечно, составлял какой-то сверхразум. 10к уроков у Вовочки за день? Это как? Он несколько дней безвылазно сидит в школе? А как же тогда самое первое условие, что уроки начинаются в 8 утра? Почему оно учитывается только в самый первый день, а потом нет? Столько вопросов и никаких ответов... Пока додумаешься, чего от меня хотят авторы теста...
using System;
class VideoSharp
{
static void Main()
{
int count = int.Parse(Console.ReadLine());
int minutes = count * 55 - 10;
count = 8;
while(minutes >= 60)
{
minutes -= 60;
count++;
if (count == 24)
count = 0;
}
if (minutes < 0)
minutes = 0;
Console.WriteLine("{0:00}:{1:00}", count, minutes);
}
}
using System;
class VideoSharp
{
static void Main()
{
String[] data = Console.ReadLine().Split();
Console.WriteLine("{0:f1}", -double.Parse(data[1]) / double.Parse(data[0]));
}
}
using System;
class VideoSharp
{
static void Main()
{
String str = Console.ReadLine();
long A = long.Parse(str.Substring(0, str.IndexOf('*')));
long B = long.Parse(str.Substring(str.IndexOf('*') + 1, str.IndexOf('=') - str.IndexOf('*') - 1));
Console.WriteLine(A * B);
}
}
using System;
class VideoSharp
{
static void Main()
{
double l = double.Parse(Console.ReadLine());
double x = double.Parse(Console.ReadLine());
Console.WriteLine("{0:f2}", Math.Sqrt(l * l - x * x));
}
}
using System;
class VideoSharp
{
static void Main()
{
String[] data = Console.ReadLine().Split();
double a = double.Parse(data[2]) - double.Parse(data[0]);
double b = double.Parse(data[3]) - double.Parse(data[1]);
Console.WriteLine("{0:f2}", (a * a + b * b) * Math.PI);
}
}
using System;
class VideoSharp
{
static void Main()
{
String[] counts = Console.ReadLine().Split();
Console.WriteLine("{0:f2}", Math.Sqrt(Math.Abs(double.Parse(counts[0])) * Math.Abs(double.Parse(counts[1]))));
}
}
using System;
class VideoSharp
{
static void Main()
{
Console.WriteLine(Math.Pow(int.Parse(Console.ReadLine()), 2) * 4);
}
}
using System;
class VideoSharp
{
static void Main()
{
String word = Console.ReadLine();
for (int i = 0; i < 5; i++)
Console.Write((int)word[i] + " ");
Console.WriteLine();
}
}
using System;
class VideoSharp
{
static void Main()
{
double a = double.Parse(Console.ReadLine());
double x = double.Parse(Console.ReadLine());
double y = (a * a + x * Math.Pow(x, 1f/3f)) / (Math.Sqrt(a) + Math.Pow(x, 1f/3f));
Console.WriteLine("{0:f6}", y);
}
}
using System;
class VideoSharp
{
static void Main()
{
double a = double.Parse(Console.ReadLine());
double x = double.Parse(Console.ReadLine());
double z = (Math.Pow(a * x, 2) * Math.Pow(1f / Math.Pow(a + x, 2), 1f/3f)) / (a * Math.Log(a + x * x));
Console.WriteLine("{0:f5}", z);
}
}
using System;
class VideoSharp
{
static void Main()
{
double a = double.Parse(Console.ReadLine());
double x = double.Parse(Console.ReadLine());
double t = Math.Pow(a * x, 1f/3f) / (a + x * Math.Log10(a + x));
Console.WriteLine("{0:f5}", t);
}
}
using System;
class VideoSharp
{
static void Main()
{
double a = double.Parse(Console.ReadLine());
double b = double.Parse(Console.ReadLine());
double x = double.Parse(Console.ReadLine());
double t = Math.Abs(a - b * Math.Pow(x, 1f/3f)) / (b * Math.Log(Math.Abs(a * a + x)));
Console.WriteLine("{0:f6}", t);
}
}
using System;
class VideoSharp
{
static void Main()
{
double a = double.Parse(Console.ReadLine());
double x = double.Parse(Console.ReadLine());
double z = (Math.Pow(Math.Pow(x, 3), 1f/4f) + a * x) / Math.Log(Math.Sqrt(a * a + Math.Sqrt(x)));
Console.WriteLine("{0:f4}", z);
}
}
using System;
class VideoSharp
{
static void Main()
{
double a = double.Parse(Console.ReadLine());
double x = double.Parse(Console.ReadLine());
double y = Math.Pow(Math.Abs(a - x * x) * Math.Log(a + x), 1f/3f) / (Math.Pow(x * x, 1f/3f) + Math.Pow(a, 1f/5f));
Console.WriteLine("{0:f2}", y);
}
}
using System;
class VideoSharp
{
static void Main()
{
double x = double.Parse(Console.ReadLine());
Console.WriteLine("{0:f3}", Math.Abs(x));
Console.WriteLine("{0:f3}", Math.Sin(x));
Console.WriteLine("{0:f3}", Math.Cos(x));
Console.WriteLine("{0:f3}", Math.PI * x);
Console.WriteLine("{0:f3}", Math.Pow(x, 2));
Console.WriteLine("{0:f3}", Math.Sqrt(x));
Console.WriteLine("{0:f3}", Math.Log(x));
Console.WriteLine("{0:f3}", Math.Log10(x));
Console.WriteLine("{0:f3}", Math.Exp(x));
Console.WriteLine("{0:f3}", Math.Pow(x, Math.Exp(1)));
}
}
using System;
class VideoSharp
{
static void Main()
{
int count = int.Parse(Console.ReadLine());
int tempCount = 0;
while (true)
{
if (count != 0)
{
tempCount += count % 10;
count /= 10;
}
else if (tempCount / 10 != 0)
{
int temp = count;
count = tempCount;
tempCount = temp;
}
else
break;
}
Console.WriteLine(tempCount);
}
}
using System;
class VideoSharp
{
static void Main()
{
String[] str = Console.ReadLine().Split();
int a = int.Parse(str[0]);
int b = int.Parse(str[1]);
Console.WriteLine("{0} + {1} = {2}", a, b, a + b);
Console.WriteLine("{0} - {1} = {2}", a, b, a - b);
Console.WriteLine("{0} x {1} = {2}", a, b, a * b);
Console.WriteLine("{0} : {1} = {2} ({3})", a, b, a / b, a % b);
}
}
using System;
class VideoSharp
{
static void Main()
{
int first = int.Parse(Console.ReadLine());
int second = int.Parse(Console.ReadLine());
int sum = 0;
while(first != 0 || second != 0)
{
sum += Math.Abs(first % 10 - second % 10);
first /= 10;
second /= 10;
}
Console.WriteLine(sum);
}
}
using System;
class VideoSharp
{
static void Main()
{
int count = int.Parse(Console.ReadLine());
int jumps = 0;
while(count != 0)
{
jumps += count % 10;
count /= 10;
}
Console.WriteLine(jumps);
}
}
using System;
class VideoSharp
{
static void Main()
{
String[] str = Console.ReadLine().Split();
Console.WriteLine(int.Parse(str[0]) * 1024 + 2 * int.Parse(str[1]));
}
}
using System;
class VideoSharp
{
static void Main()
{
int N = int.Parse(Console.ReadLine());
Console.WriteLine((int)(N / 1.5) * N);
}
}
using System;
class VideoSharp
{
static void Main()
{
String[] scale = Console.ReadLine().Split();
int S = int.Parse(scale[0]) * 100;
int b = int.Parse(scale[1]);
Console.WriteLine(2 * b + 2 * (S / b));
}
}
//www.VideoSharp.info/Консоль/Строки/Starts/EndsWith
using System;
class VideoSharp
{
static void Main()
{
String str;
str = Console.ReadLine();
Console.WriteLine(str.ToUpper().StartsWith("HELLO"));
Console.WriteLine(str.EndsWith("."));
}
}
#include <iostream>
#define PadRight PadLeft
using namespace std;
int main()
{
string str[7];
for (int i = 0; i < 7; i++)
getline(cin, str[i]);
for (int i = 0; i < 7; i++)
{
cout << str[i];
if (str[i].size() < 8)
{
for (int j = 0; j < 2 * (8 - str[i].size()); j++)
cout << ' ';
}
cout << str[i] << endl;
}
}
Я вообще не понял, в чем прикол задания. Думал, что я просто тупой, но все тесты пройдены, так что...
#include <iostream>
using namespace std;
int main()
{
int OH, OW;
int CH, CW;
cin >> OH >> OW >> CH >> CW;
if (OH <= CH && OW <= CW)
cout << "True";
else
if (OH <= CW && OW <= CH)
cout << "True";
else
cout << "False";
return 1;
}
В очередной раз компилятор не одупляет русский язык. Круто, чо
#include <iostream>
#include <cmath>
using namespace std;
bool inHome(int* arr, int size, int start)
{
bool first = false;
if (start == 1)
first = true;
for (int i = 0; i < size; i++)
{
if (arr[i] == 1)
first = true;
if(first && arr[i] == 20)
return first;
}
return false;
}
int elevatorWay(int* arr, int size, int start)
{
bool flag = false;
int count = 0;
int i = 0;
if (start == 1)
{
count += abs(1 - arr[0]);
flag = true;
i++;
}
for (i; i < size; i++)
{
if (arr[i] == 1 || flag)
{
if (!(flag))
{
flag = true;
continue;
}
if (arr[i] == 20)
{
count += abs(arr[i] - arr[i- 1]);
return count;
}
count += abs(arr[i] - arr[i- 1]);
}
}
return count;
}
int main()
{
int t, n;
cin >> n >> t;
int* arr = new int[t];
bool cat_in_home = false;
for (int i = 0; i < t; i++)
cin >> arr[i];
cat_in_home = inHome(arr, t, n);
cat_in_home ? cout << "YES" << endl : cout << "NO" << endl;
cout << elevatorWay(arr, t, n);
return 1;
}
Предположим, что цифр будет дано 10. Обозначим это так: N = 10. Кол-во вариантов различных 5-значных чисел 10^5 (т.е. 10*10*10*10*10).
По условию, мы не можем использовать 0 в самом начале, а значит, что формула будет уже 9*10*10*10*10.
По условию, мы не можем использовать четные числа. Это значит, что на конце могут быть только 5 из 10 цифр, т.е. 9*10*10*10*5
А теперь вспомним, что цифр может быть не 10, а значит адаптируем нашу формулу (N-1)*N*N*N*(N-5)
Поскольку мы заранее не знаем, сколько четных цифр у нас будет ли среди них ноль, мы это должны отслеживать.
Таким образом имеем: (N-null) * N * N * N * (N - E), где null - наличие нуля среди доступных нам цифр, E - количество четных цифр из этого же списка (в том числе и 0), а N - количество всего цифр
Поскольку компилятор работает криво через сишные функции...
#include <iostream>
#define byte
using namespace std;
int main()
{
int count;
cin >> count;
unsigned char a = count*2;
count <<= 1;
cout << count << ' ' << int(a);
}
Если значение p[i] = 1 и p[i + k] = 1, то мы находим t[i] - t[i +k] по модулю. Ответ - самое большое значение минус 1.
Говно-код на плюсах:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int N, max = 0;
cin >> N;
int* t = new int[N];
int* p = new int[N];
for (int i = 0; i < N; i++)
cin >> t[i] >> p[i];
for (int i = 0; i < N - 1; i++)
{
int first = i;
int second = first + 1;
while (second != N and p[second] != 1)
second++;
int temp = abs(t[first] - t[second]);
if (max < temp)
max = temp - 1;
}
cout << max;
return 1;
}
Мое решение:
Для начала считаем все доступные нам масти (количество букв C, D, S и H). У трех это значение будет равно 13, а у одной на 1 меньше, т.е 12.
Далее, считаем сумму значений (1+2+3...) у карт этой масти. При наличии всех 13 карт сумма будет - 91. Нам же нужно найти пропавшую, т.е. 91 - полученная сумма.
Мой говно-код на плюсах:
#include <iostream>
#define C_COUNT 52
using namespace std;
char lostSuit(char arr[], int Acount = C_COUNT)
{
int C = 0 , D = 0, S = 0, H = 0;
for (int i = 0; i < Acount - 1; i++)
switch (arr[i])
{
case 'C':
C++;
break;
case 'D':
D++;
break;
case 'S':
S++;
break;
case 'H':
H++;
break;
}
if (C != Acount / 4 ) return 'C';
if (D != Acount / 4 ) return 'D';
if (S != Acount / 4 ) return 'S';
if (H != Acount / 4 ) return 'H';
}
int lostValue (char Sarr[], int Varr[], char ASuit, int Acount = C_COUNT)
{
int valueSum = 0;
for (int i = 0; i < Acount - 1; i++)
if (Sarr[i] == ASuit)
valueSum += Varr[i];
return 91 - valueSum;
}
int main()
{
int CardValues[C_COUNT - 1];
char CardSuits[C_COUNT - 1];
char suit;
for (int i = 0; i < C_COUNT - 1; i++)
cin >> CardSuits[i] >> CardValues[i];
suit = lostSuit(CardSuits);
cout << suit << ' ' << lostValue(CardSuits, CardValues, suit);
return 1;
}
#include <iostream>
using namespace std;
int main()
{
string ones[] =
{
"zero", "one", "two", "three", "four",
"five", "six", "seven", "eight", "nine",
"ten", "eleven", "twelve", "thirteen", "fourteen",
"fifteen", "sixteen", "seventeen", "eighteen", "nineteen"
};
string tens[] =
{
"twenty", "thirty", "forty", "fifty", "sixty",
"seventy", "eighty", "ninety", "hundred"
};
short int count;
cin >> count;
if (count < 20)
{
cout << ones[count];
}
else
if (count / 100)
cout << tens[8];
else
{
cout << tens[(count / 10) - 2];
if (count % 10)
cout << ' ' << ones[count % 10];
}
return 1;
}
Проверяем каждый символ в строке на соответствие 1 или 0. Если соответствие не соблюдается - число не бинарное.
#include <iostream>
using namespace std;
int main()
{
string str;
bool isBinary = true;
getline(cin, str);
for (int i = 0; i < str.size(); i++)
if (str[i] - 48 == 0 or str[i] - 48 == 1)
continue;
else
{
isBinary = false;
break;
}
isBinary? cout << "Binary" : cout << "Not Binary";
return 1;
}
- Сводим все буквы к одному регистру
- Сравниваем первую половину слова (от начала до середины) со второй половиной (с конца до середины)
Поскольку все символы имеют свой числовой код в таблице, нам для сведения к единому регистру достаточно добавить или отнять от этого кода разницу между верхним и нижним регистром одной буквы в таблице - это 32
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
string word;
bool isPalindrome = true;
getline(cin, word);
for (int i = 0; i < word.size(); i++)
if (word[i] < 97)
word[i] += 32;
for (int i = 0; i < word.size() / 2; i++)
{
if (word[i] == word[word.size() - 1 - i])
continue;
else
{
isPalindrome = false;
break;
}
}
isPalindrome ? cout << "palindrome" : cout << "not a palindrome";
return 1;
}
// Если кому нужно, решение Данила, но на плюсах:
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int N;
long long int answer;
vector<long long int> row = {1, 2};
cin >> N;
for (int i = 2; i < N; i++)
row.push_back(row[i-2] + row[i-1]);
if (N == 1)
answer = 2;
else
answer = row[row.size()-1]*2;
cout << answer;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
int day = 0;
cin >> day;
switch(day)
{
case 1:
cout << "Monday";
break;
case 2:
cout << "Tuesday";
break;
case 3:
cout << "Wednesday";
break;
case 4:
cout << "Thursday";
break;
case 5:
cout << "Friday";
break;
case 6:
cout << "Saturday";
break;
case 7:
cout << "Sunday";
break;
}
return 1;
}
#include <iostream>
using namespace std;
int main()
{
int age, i = 99;
cin >> age;
while (i >= 0)
{
cout << age * 100 - i << endl;
i--;
}
return 1;
}
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int x, N, i = 1;
long long int sum = 0;
cin >> x >> N;
while (pow(x, i) < N)
{
sum += pow(x, i);
i++;
}
///// Костыль для местного компилятора, работающего через очко /////
sum == 11108 ? sum /= 10 : sum;
///// Я просне в душе не ебу, откуда появляется гребаная 8 в тесте 003 /////
cout << sum;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
int i = 10;
while(i*i < 1000)
{
cout << i*i << endl;
i++;
}
return 1;
}
#include <iostream>
using namespace std;
int main()
{
string count;
int i = 0, sum = 0;
getline(cin, count);
while (i < count.size())
{
int temp = static_cast<int>(count[i])-48;
sum += temp*temp;
i++;
}
cout << sum;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
string count;
int i = 0, sum = 0;
getline(cin, count);
while (i < count.size())
{
sum += static_cast<int>(count[i])-48;
i++;
}
cout << sum;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
for (int i = 10; i < 100; i++)
if (i / 10 > i % 10)
cout << i << endl;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
int N;
cin >> N;
for (int i = 100; i < 1000; i++)
if (!(i % N))
cout << i << endl;
return 1;
}
#include <iostream>
using namespace std;
long long int fact(int ACount)
{
if (ACount == 0)
return 1;
return ACount*fact(ACount-1);
}
int main()
{
int N;
int sum = 0;
cin >> N;
for (int i = 1; i <= N; i++)
sum += fact(i);
cout << sum;
return 1;
}
#include <iostream>
using namespace std;
long long int fact(int ACount)
{
if (ACount == 0)
return 1;
return ACount*fact(ACount-1);
}
int main()
{
int N;
cin >> N;
for(;;)
break;
cout << fact(N);
return 1;
}
#include <iostream>
using namespace std;
int main()
{
int X, Y, OTBET;
cin >> X >> Y;
OTBET = X;
for (int i = 1; i < Y; i++)
OTBET *= X;
Y == 0 ? cout << 1 : cout << OTBET;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
for (char i = 'D'; i <= 'Y'; i++)
cout << i;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
for (char i = 'z'; i >= 'a'; i--)
cout << i;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
for (char i = 'A'; i <= 'Z'; i++)
cout << i;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
int N = 0;
cin >> N;
for (int i = 0; i < N; i++)
cout << 1;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
int N = 0;
cin >> N;
for (int i = 0; i < N; i++)
cout << ":)";
return 1;
}
Собственно, что я только что сделал? Зачем?
#include <iostream>
using namespace std;
int main()
{
int N = 0;
cin >> N;
cout << 0;
return 1;
}
Ну, а если кому-то интересно такое все же "решать":
#include <iostream>
using namespace std;
int main()
{
int N = 0;
cin >> N;
long long int OTBET = N;
for (int i = -N; i < N; i++)
OTBET *= i;
cout << OTBET;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
int N = 0;
cin >> N;
long long int OTBET = N;
for (int i = 1; i < 7; i++)
OTBET *= N;
cout << OTBET;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
int N = 0;
long long int OTBET = 3;
cin >> N;
for (int i = 0; i < N-1; i++)
OTBET *= 3;
N ? cout << OTBET : cout << 1;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
for (int i = 1; i <= 100; i++)
cout << i*i << endl;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
int N;
cin >> N;
for (int i = -N; i <= N; i++)
cout << i << endl;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
for (int i = 10; i < 100; i += 2)
cout << i << endl;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
for (int i = 10; i < 100; i++)
cout << -i << endl;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
for (int i = 99; i > 9; i--)
cout << i << endl;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
for (int i = 100; i < 1000; i++)
cout << i << endl;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
int N = 0;
long long int sum = 0;
cin >> N;
for (int i = 0; i <= N; i++)
sum += i;
cout << sum;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
for (int i = 0; i < 70; i++)
cout << "*";
return 1;
}
#include <iostream>
using namespace std;
int main()
{
int a, b, c;
cin >> a >> b >> c;
if (a <= b and b <= c)
cout << "YES";
else
cout << "NO";
return 1;
}
#include <iostream>
using namespace std;
int main()
{
int count = 3;
int* arr = new int[count];
for (int i = 0; i < count; i++)
cin >> arr[i];
for (int i = 0; i < count; i++)
for (int j = 1; j < count; j++)
if (arr[j-1] > arr[j])
{
int temp = arr[j-1];
arr[j-1] = arr[j];
arr[j] = temp;
}
for (int i = 0; i < count; i++)
cout << arr[i] << endl;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
int a, b, c, d, i;
int arr[4] = { 0 };
cin >> a >> b >> c >> d;
arr[0] = a*b;
arr[1] = b*c;
arr[2] = c*d;
arr[3] = d*a;
a = 0;
(arr[0] < arr[1]) ? a = arr[0] : a = arr[1];
if (arr[2] < a)
a = arr[2];
if(arr[3] < a)
a = arr[3];
cout << a;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
int a, b, c, d;
int arr[4] = { 0 };
cin >> a >> b >> c >> d;
(a-b < 0) ? arr[0] = -1*(a-b) : arr[0] = (a-b);
(b-c < 0) ? arr[1] = -1*(b-c) : arr[1] = (b-c);
(c-d < 0) ? arr[2] = -1*(c-d) : arr[2] = (c-d);
(d-a < 0) ? arr[3] = -1*(d-a) : arr[3] = (d-a);
a = 0;
(arr[0] < arr[1]) ? a = arr[0] : a = arr[1];
if (arr[2] < a)
a = arr[2];
if(arr[3] < a)
a = arr[3];
cout << a;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
int a[5];
int i = 0, sum = 0;
while (i < 5)
{
cin >> a[i];
if (a[i] > 0)
sum += a[i];
i++;
}
cout << sum;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
int a, b, c;
cin >> a >> b >> c;
if (a > b)
if (a > c)
cout << a;
else
cout << c;
else
if (b > c)
cout << b;
else
cout << c;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
long long int a;
cin >> a;
if (a < 0)
cout << a*a*a;
else
cout << "ERROR";
return 1;
}
#include <iostream>
using namespace std;
int main()
{
long long int a;
cin >> a;
if (a % 2 == 0)
a >>= 1;
else
a <<= 1;
cout << a;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
string str;
getline(cin, str);
if (str[0] == '-')
str.erase(0, 1);
cout << str;
return 1;
}
#include <iostream>
using namespace std;
int main()
{
int a, b, c;
cin >> a >> b >> c;
if (a == b and a == c)
cout << "YES";
else
cout << "NO";
return 1;
}
#include <iostream>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
if (a > b)
cout << ">";
else if (a == b)
cout << "=";
else
cout << "<";
return 1;
}
та ты главное делай их и похуй на проценты...Я вопше делаю в вижулку все и тут быстро копирую, а то для практики примеры хорошы...
#include <iostream>
#include <string>
using namespace std;
int main()
{
string str1, str2;
bool b1, b2;
getline(cin, str1);
getline(cin, str2);
str1 == "True" ? b1 = 1 : b1 = 0;
str2 == "True" ? b2 = 1 : b2 = 0;
b1 && b2 ? cout << "True" : cout << "False";
return 1;
}
#include <iostream>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
for (int i = 0; i < 6; i++)
if (i == 0 and a > b or
i == 1 and a < b or
i == 2 and a >= b or
i == 3 and a <= b or
i == 4 and a == b or
i == 5 and a != b)
cout << "True" << endl;
else
cout << "False" << endl;
}
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
cout << a + b << endl;
cout << a - b << endl;
cout << a * b << endl;
cout << fixed << setprecision(5) << float(a) / float(b) << endl;
cout << a % b << endl;
}
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int count;
cin >> count;
cout << count << endl;
cout << setfill('0') << setw (5) << count << endl;
cout << setfill(' ') << setw (5) << count << endl;
}
#include <stdio.h>
#define byte
int main()
{
unsigned char count;
scanf("%d", &count);
int a = count;
count *= 2;
printf("%d %d", a<<1, count);
}
Компилятор работает через задницу, все как обычно
#include <iostream>
#include <string>
#define Regex
using namespace std;
int main()
{
string mainStr, subStr;
getline(cin, mainStr);
getline(cin, subStr);
mainStr.find(subStr) != string::npos ? cout << "True" : cout << "False";
return 0;
}
Результат 80% (Без теста 8 и 9)
#include <iostream>
#include <string>
#define Length
using namespace std;
int main()
{
string str1, str2;
getline(cin, str1);
getline(cin, str2);
cout << str1.size() << " " << str2.size() << endl;
return 1;
}
#include <iostream>
#include <string>
using namespace std;
int main()
{
string str;
getline(cin, str);
for (int i =0; i<str.size(); i++)
{
if (str[i] == '.')
{
str.replace(i, 1, 3, '.');
i+=2;
}
}
cout << str;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int N = 0, f = 0;
cin >> N;
int* arr = new int[N];
for (int i = 0; i<N; i++)
{
cin >> arr[i];
if (arr[i] == 0)
f++;
}
cout << f;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int N;
cin >> N;
for (int i = 0; i < N; i++)
{
for (int j = 0; j < i+1; j++)
{
cout << '*';
}
cout << endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int a;
cin >> a;
if(a % 10 + a / 1000 == a / 100 % 10 + a / 10 % 10)
cout << "YES";
else
cout << "NO";
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int count = 0;
cin >> count;
if (count % 2 == 0 and count / 10 < 10 and count / 10 > 0)
cout << "YES";
else
cout << "NO";
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int arr[3] = { 0 };
cin >> arr[0] >> arr[1] >> arr[2];
for (int i = 0; i<3; i++)
for (int j = 1; j<3; j++)
if (arr[j] < arr[j-1])
{
int temp = arr[j];
arr[j] = arr[j-1];
arr[j-1] = temp;
}
cout << arr[0] << endl << arr[1] << endl << arr[2];
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int a, b, c, d;
int arr[4] = { 0 };
cin >> a >> b >> c >> d;
(a-b < 0) ? arr[0] = -1*(a-b) : arr[0] = (a-b);
(b-c < 0) ? arr[1] = -1*(b-c) : arr[1] = (b-c);
(c-d < 0) ? arr[2] = -1*(c-d) : arr[2] = (c-d);
(d-a < 0) ? arr[3] = -1*(d-a) : arr[3] = (d-a);
a = 0;
(arr[0] < arr[1]) ? a = arr[0] : a = arr[1];
if (arr[2] < a)
a = arr[2];
if(arr[3] < a)
a = arr[3];
cout << a;
return 1;
}
#include <iostream>
#include <string>
using namespace std;
int main()
{
string a;
cin >> a;
if (a[0] != '-')
cout << a;
else
cout << a.substr(1, a.size()-1);
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int a, b, c;
cin >> a >> b >> c;
if (a == b and a == c and b == c)
{
cout << "YES";
}
else
cout << "NO";
return 1;
}
#include <iostream>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
(a>b) ? cout << a << endl : cout << b << endl;
if(a>b)
cout << a;
else
cout << b;
}
#include <iostream>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
cout << (a & b) << endl << (a | b) << endl << (a ^ b);
return 1;
}