First commit

This commit is contained in:
Cation 2022-02-07 21:33:05 +02:00
commit be190ada6d
17 changed files with 297 additions and 0 deletions

6
BOILERPLATE.cpp Normal file
View File

@ -0,0 +1,6 @@
#include <stdio.h>
int main(){
freopen("INPUT.TXT", "r", stdin);
freopen("OUTPUT.TXT", "w", stdout);
}

1
INPUT.TXT Normal file
View File

@ -0,0 +1 @@

1
OUTPUT.TXT Normal file
View File

@ -0,0 +1 @@

16
arifmetik.cpp Normal file
View File

@ -0,0 +1,16 @@
//acmp.ru 0008
#include <stdio.h>
int main(){
freopen("INPUT.TXT", "r", stdin);
freopen("OUTPUT.TXT", "w", stdout);
int a, b, c;
scanf("%i %i %i", &a, &b, &c);
if (a * b == c){
printf("%s", "YES");
}else {
printf("%s", "NO");
}
}

23
basketball.cpp Normal file
View File

@ -0,0 +1,23 @@
//acmp.ru 0061 basketball.cpp 5%
#include <stdio.h>
int main(){
freopen("INPUT.TXT", "r", stdin);
freopen("OUTPUT.TXT", "w", stdout);
short a,b,tota=0, totb=0;
for(int i = 0; i < 4; i++){
scanf("%hi %hi", &a, &b);
tota = tota + a;
totb = totb + b;
}
if (tota > totb){
printf("1");
}else if (totb > tota){
printf("2");
}else {
printf("DRAW");
}
}

19
binarnie_cisla.cpp Normal file
View File

@ -0,0 +1,19 @@
//acmp.ru 0692 binarnie_cisla.cpp 8%
#include <stdio.h>
#include <math.h>
int main(){
freopen("INPUT.TXT", "r", stdin);
freopen("OUTPUT.TXT", "w", stdout);
unsigned int N;
scanf("%i", &N);
for (int i = 0; i <= 32; i++){
if(log2(N) == i){
printf("YES");
return 0;
}
}
printf("NO");
return 0;
}

13
juravliki.cpp Normal file
View File

@ -0,0 +1,13 @@
//acmp.ru 0092 juravliki.cpp 7%
#include <stdio.h>
#include <stdlib.h>
int main(){
freopen("INPUT.TXT", "r", stdin);
freopen("OUTPUT.TXT", "w", stdout);
int S, x;
scanf("%i", &S);
x = S/6;
printf("%i %i %i", x, x*4, x);
}

30
monetki.cpp Normal file
View File

@ -0,0 +1,30 @@
//acmp.ru 0106 moentki.cpp 8%
#include <stdio.h>
int main(){
freopen("INPUT.TXT", "r", stdin);
freopen("OUTPUT.TXT", "w", stdout);
int num;
scanf("%i", &num);
int arr[num], c0 = 0, c1 = 0;
for(int i = 0; i < num; i++){
scanf("\n%i", &arr[i]);
}
for(int i = 0; i < num; i++){
if(arr[i] == 0){
c0 = c0 + 1;
}else if (arr[i] == 1){
c1 = c1 + 1;
}
}
if (c0 > c1){
printf("%i", c1);
}else if (c1 > c0){
printf("%i", c0);
}
}

17
mouse.cpp Normal file
View File

@ -0,0 +1,17 @@
//acmp.ru 0907 mouse.cpp 9%
#include <stdio.h>
int main(){
freopen("INPUT.TXT", "r", stdin);
freopen("OUTPUT.TXT", "w", stdout);
int w,h,r;
scanf("%i %i %i", &w, &h, &r);
r = r*2;
if(r <= w && r <= h){
printf("YES");
}else{
printf("NO");
}
}

16
nezemniye_gosti.cpp Normal file
View File

@ -0,0 +1,16 @@
//acmp.ru 0597 nezemniye.cpp 10%
#include <stdio.h>
int main(){
freopen("INPUT.TXT", "r", stdin);
freopen("OUTPUT.TXT", "w", stdout);
int r1, r2, r3;
scanf("%i %i %i", &r1, &r2, &r3);
if(r1 >= r2+r3){
printf("YES");
}else{
printf("NO");
}
}

View File

@ -0,0 +1,17 @@
//acmp.ru 0970 ot_perestanovki_shtoto_menyaetsa.cpp 9%
#include <stdio.h>
int main(){
freopen("INPUT.TXT", "r", stdin);
freopen("OUTPUT.TXT", "w", stdout);
int a,b,c;
scanf("%i %i %i", &a, &b, &c);
if(a+b == c || b+c == a || c+a == b){
printf("YES");
}else{
printf("NO");
}
}

19
razvorot.cpp Normal file
View File

@ -0,0 +1,19 @@
//acmp.ru 0149 razvorot.cpp 9%
#include <stdio.h>
int main(){
freopen("INPUT.TXT", "r", stdin);
freopen("OUTPUT.TXT", "w", stdout);
int num;
scanf("%i", &num);
int arr[num];
for(int i = 0; i < num; i++){
scanf("\n%i", &arr[i]);
}
for(int i = num-1; i >= 0; i--){
printf("%i ", arr[i]);
}
}

17
sbor_zemlyaniki.cpp Normal file
View File

@ -0,0 +1,17 @@
//acmp.ru 0755 sbor_zemlyaniki.cpp 6%
#include <stdio.h>
int main(){
freopen("INPUT.TXT", "r", stdin);
freopen("OUTPUT.TXT", "w", stdout);
short x, y, z;
scanf("%hi%hi%hi", &x, &y, &z);
if(z > x + y){
printf("Impossible");
}else {
printf("%hi", (x+y)-z);
}
}

20
tort.cpp Normal file
View File

@ -0,0 +1,20 @@
//acmp.ru 0539 tort.cpp 6%
#include <stdio.h>
int main(){
freopen("INPUT.TXT", "r", stdin);
freopen("OUTPUT.TXT", "w", stdout);
short N;
scanf("%hi", &N);
if (N <= 1){
printf("0");
}else if(N % 2 == 0){
printf("%hi", N / 2);
}else if(N % 2 != 0){
printf("%hi", N);
}else {
printf("0");
}
}

25
tri_tolstyaka.cpp Normal file
View File

@ -0,0 +1,25 @@
//acmp.ru 0754 tri_tolstyaka.cpp 7%
#include <stdio.h>
int main(){
freopen("INPUT.TXT", "r", stdin);
freopen("OUTPUT.TXT", "w", stdout);
int M1, M2, M3;
scanf("%i %i %i", &M1, &M2, &M3);
int arr[3] = {M1, M2, M3};
int max = 0;
for(int i = 0; i < 3; i++){
if(arr[i] >= 94 && arr[i] <= 727){
if(arr[i] > max){
max = arr[i];
}
}else {
printf("Error");
return 0;
}
}
printf("%i", max);
return 0;
}

26
vremena_goda.cpp Normal file
View File

@ -0,0 +1,26 @@
#include <stdio.h>
int main(){
freopen("INPUT.TXT", "r", stdin);
freopen("OUTPUT.TXT", "w", stdout);
int month;
scanf("%i", &month);
switch(month){
case 12:case 1:case 2:
printf("Winter");
break;
case 3:case 4:case 5:
printf("Spring");
break;
case 6:case 7:case 8:
printf("Summer");
break;
case 9:case 10:case 11:
printf("Autumn");
break;
default:
printf("Error");
break;
}
}

31
zolotoy_pesok.cpp Normal file
View File

@ -0,0 +1,31 @@
//acmp.ru 0685 zolotoy_pesok.cpp 10%
#include <stdio.h>
int main(){
freopen("INPUT.TXT", "r", stdin);
freopen("OUTPUT.TXT", "w", stdout);
int arr1[3], arr2[3];
scanf("%i %i %i %i %i %i", &arr1[0], &arr1[1], &arr1[2], &arr2[0], &arr2[1], &arr2[2]);
int maxprice = 0, maxkg = 0, pri, kgi, currentprice = 0;
for (int j = 0; j < 3; j++){
for (int i = 0; i < 3; i++){
if(arr1[i] > maxprice){
maxprice = arr1[i];
pri = i;
}
if(arr2[i] > maxkg){
maxkg = arr2[i];
kgi = i;
}
}
arr1[pri] = 0;
arr2[kgi] = 0;
currentprice = currentprice+(maxkg * maxprice);
maxkg = 0;
maxprice = 0;
}
printf("%i",currentprice);
}