Вы находитесь на странице: 1из 5

A.

Гипотенуза

#include <iostream>
#include <cmath>
using namespace std;

int main() {
int a,b;
cin >> a >> b;
cout << sqrt(a*a + b*b);
return 0;
}

B. Следующее и предыдущее

#include <iostream>
using namespace std;

int main()
{
int c, next, prev;
cin >> c;
next = c+1;
prev = c-1;
cout << "The next number for the number "<<c<<" is "<<next<<"."<<endl;
cout << "The previous number for the number "<<c<<" is "<<prev<<".";
return 0;
}

C. Дележ яблок - 1

#include <iostream>
#include <cmath>
using namespace std;

int main() {
int a,b;
cin >> a >> b;
cout << b/a;
return 0;
}

D. Дележ яблок - 2

#include <iostream>
#include <cmath>
using namespace std;

int main() {
int a,b;
cin >> a >> b;
cout << b % a;
return 0;
}

E. МКАД

#include <iostream>
#include <cmath>
using namespace std;

int main() {
int v,t;
cin >> v >> t;
cout << (109 + v*t%109)%109;
return 0;
}

F. Последняя цифра

#include <iostream>
#include <cmath>
using namespace std;

int main() {
int v;
cin >> v;
cout << v % 10;
return 0;
}

G. Число десятков двузначного числа

#include <iostream>
#include <cmath>
using namespace std;

int main() {
int v;
cin >> v;
cout << v / 10;
return 0;
}

H. Число десятков

#include <iostream>
#include <cmath>
using namespace std;

int main() {
int v;
cin >> v;
cout << v/10%10;
return 0;
}

I. Сумма цифр

#include <iostream>
#include <cmath>
using namespace std;

int main() {
int v;
cin >> v;
cout << v/100 + v/10%10 + v%10 ;
return 0;
}

J. Следующее четное

#include <iostream>
#include <cmath>
using namespace std;

int main() {
int v;
cin >> v;
cout << -v%2 + v + 2 ;
return 0;
}

K. Электронные часы - 1

#include <iostream>
#include <cmath>
using namespace std;

int main() {
int v;
cin >> v;
cout << v/60%24 << " " << v % 60;
return 0;
}

L. Электронные часы - 2

#include <iostream>
using namespace std;

int main() {
int a,h,m,s;
cin >> a;
h = a/3600%24;
m = a/60%60;
s = a%60;
cout << h << ':' << m/10 << m%10 << ':' << s/10 << s%10;
return 0;
}

M. Обмен значений

#include <iostream>
using namespace std;

int main() {
int a,b,c;
cin >> a >> b;
c = a;
a = b;
b = c;
cout << a << ' ' << b;
return 0;
}

N. Конец уроков
#include <iostream>
using namespace std;

int main() {
int a,t;
cin >> a;
t = ((a+1)/2-1)*15 + (a/2)*5 + a*45;
cout << t/60 + 9 << ' ' << t%60;
return 0;
}

O. Стоимость покупки

#include <iostream>
using namespace std;

int main() {
int a,b,n;
cin >> a >> b >> n;
cout << n*a + n*b/100 << ' ' << n*b%100 ;
return 0;
}

P. Разность времен

#include <iostream>
using namespace std;

int main() {
int a,b,c,d,f,g;
cin >> a >> b >> c;
cin >> d >> f >> g;
cout << -((a-d)*3600+(b-f)*60+(c-g));
return 0;
}

Q. Автопробег

#include <iostream>
using namespace std;

int main() {
int a,b;
cin >> a >> b;
cout << (a+b-1)/a;
return 0;
}

R. Дележ яблок - 3

#include <iostream>
using namespace std;

int main() {
int a,b;
cin >> a >> b;
cout << (a-b%a)%a;
return 0;
}

S. Улитка

#include <iostream>
using namespace std;

int main()
{
int a, b, h;
cin >> h >>a >> b;
cout <<(h/(a-b)-(a-(h%(a-b)))/(a-b)) + 1;
return 0;
}

T. Симметричное число**

#include <iostream>
using namespace std;

int main()
{
int a;
cin>>a;
cout <<(a/1000-a%10)+(a%1000/100 - a%100/10) + (a/1000+a%1000/100 )-(a%10+ a
%100/10) +1;
}

U. Проверьте делимость

#include <iostream>
using namespace std;

int main() {
int a,b;
cin >> a >> b;
cout << (a%b)*(b%a)+1;
return 0;
}

V. Максимум

#include <iostream>
using namespace std;

int main()
{
int a,b;
cin>>a>>b;
cout <<(a/b*a+b/a*b)/(a/b+b/a);
return 0;
}

Вам также может понравиться