Задача А. Миронюк Костянтин
#include <bits/stdc++.h>
using namespace std;
int main()
{
int x1, y1, x2, y2, x3, y3, x4, y4;
cin >> x1 >> y1 >> x2 >> y2;
x3 = x1, x4 = x2;
y3 = y2, y4 = y1;
if (x3 > x4) {
swap(x3, x4);
swap(y3, y4);
}
cout << x3 << ' ' << y3 << ' ' << x4 << ' ' << y4;
}
Задача В. Миронюк Костянтин
#include <bits/stdc++.h>
#define file_in freopen("media.dat", "r", stdin);
#define file_out freopen("media.sol", "w", stdout);
using namespace std;
int ad, vd, ln;
int main()
{
file_in; file_out;
string s;
while (cin >> s) {
ln = s.size();
if (s[ln - 1] == 'i' || s[ln - 2] == 'm')
vd ++; else
if (s[ln - 1] == '3' || s[ln - 2] == 'a')
ad ++;
}
if (ad == vd)
cout << "equal"; else
if (ad > vd)
cout << "audio\n" << ad - vd; else
if (ad < vd)
cout << "video\n" << vd - ad;
}
Задача С. Мисечко Артемій
#include <iostream>
using namespace std;
int main()
{
int num1 = 0, num2 = 0, triple1 = 0, triple2 = 0, k = 1, a ,b ,c, sum;
while (cin >> a >> b >> c)
{
sum = a + b + c;
if (sum%5 != 0)
{
k = (k + 1)%2;
continue;
}
sum /= 5;
if (k == 1)
{
if (sum + num1 > 51)
{
k = 0;
continue;
}
if (sum + num1 == 51)
{
cout << "1 " << triple1+1 << '\n';
return 0;
}
if (sum > 0)
{
num1 += sum;
++triple1;
}
k = 0;
}
else
{
if (sum + num2 > 51)
{
k = 1;
continue;
}
if (sum + num2 == 51){
cout << "2 " << triple2+1 << '\n';
return 0;
}
if (sum > 0)
{
num2 += sum;
++triple2;
}
k = 1;
}
}
}
Задача D. Бушовський Олександр
n=int(input())
ans=[]
l=['1','2','3','4','5','6','7','8','9','0']
for _ in range(n):
x=list(input())
if (not x[0] in l or x[0]!='-' or x[0]!='+') and not x[-1] in l:
ans+=["No"]
continue
for i in range(1,len(x)-1):
if not x[i] in l:
if not x[i-1] in l or not x[i+1] in l:
ans+=["No"]
break
elif x[i]=='0':
if x[i-1]=='/':
ans+=['No']
break
else: ans+=["Yes"]
print("\n".join(ans))
Задача Е. Ачілов Андрій
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n; string str;
cin >> n;
for(int i = 0; i < n; i++)
{
cin >> str;
int q = 2, cnt = 0;
for(int i = 0; i < strlen(str.c_str()); i++)
{
if(q == 0)
{
if(str[i] == '+' || str[i] == '-' || str[i] == '*' || str[i] == '/' || str[i] == ')')break;
else if(str[i] == '('){q = 2; cnt++;}
else q = 1;
}
else if(q == 2)
{
if(str[i] == '+' || str[i] == '*' || str[i] == '/' || str[i] == ')'){q = 0; break;}
else if(str[i] == '-')q = 0;
else if(str[i] == '(')cnt++;
else q = 1;
}
else if(q == 3)
{
if(str[i] == '+' || str[i] == '-' || str[i] == '*' || str[i] == '/')q = 0;
else if(str[i] == ')')
{
cnt--;
if(cnt < 0)break;
}
else if(str[i] == '('){q = 2; break;}
else {q = 1; break;}
}
else
{
if(str[i] == '('){q = 2; break;}
else if(str[i] == '+' || str[i] == '-' || str[i] == '*' || str[i] == '/')q = 0;
else if(str[i] == ')' && cnt > 0)
{
cnt--;
if(cnt < 0)break;
q = 3;
}
}
}
(q == 1 || q == 3) && cnt == 0 ? cout << "Yes" << endl : cout << "No" << endl ;
}
return 0;
}