From be190ada6df0de06671bef5f97219d6db6f5ef21 Mon Sep 17 00:00:00 2001 From: Cation Date: Mon, 7 Feb 2022 21:33:05 +0200 Subject: [PATCH] First commit --- BOILERPLATE.cpp | 6 ++++++ INPUT.TXT | 1 + OUTPUT.TXT | 1 + arifmetik.cpp | 16 ++++++++++++++ basketball.cpp | 23 +++++++++++++++++++++ binarnie_cisla.cpp | 19 +++++++++++++++++ juravliki.cpp | 13 ++++++++++++ monetki.cpp | 30 +++++++++++++++++++++++++++ mouse.cpp | 17 +++++++++++++++ nezemniye_gosti.cpp | 16 ++++++++++++++ ot_perestanovki_shtoto_menyaetsa.cpp | 17 +++++++++++++++ razvorot.cpp | 19 +++++++++++++++++ sbor_zemlyaniki.cpp | 17 +++++++++++++++ tort.cpp | 20 ++++++++++++++++++ tri_tolstyaka.cpp | 25 ++++++++++++++++++++++ vremena_goda.cpp | 26 +++++++++++++++++++++++ zolotoy_pesok.cpp | 31 ++++++++++++++++++++++++++++ 17 files changed, 297 insertions(+) create mode 100644 BOILERPLATE.cpp create mode 100644 INPUT.TXT create mode 100644 OUTPUT.TXT create mode 100644 arifmetik.cpp create mode 100644 basketball.cpp create mode 100644 binarnie_cisla.cpp create mode 100644 juravliki.cpp create mode 100644 monetki.cpp create mode 100644 mouse.cpp create mode 100644 nezemniye_gosti.cpp create mode 100644 ot_perestanovki_shtoto_menyaetsa.cpp create mode 100644 razvorot.cpp create mode 100644 sbor_zemlyaniki.cpp create mode 100644 tort.cpp create mode 100644 tri_tolstyaka.cpp create mode 100644 vremena_goda.cpp create mode 100644 zolotoy_pesok.cpp diff --git a/BOILERPLATE.cpp b/BOILERPLATE.cpp new file mode 100644 index 0000000..cfa79a6 --- /dev/null +++ b/BOILERPLATE.cpp @@ -0,0 +1,6 @@ +#include + +int main(){ + freopen("INPUT.TXT", "r", stdin); + freopen("OUTPUT.TXT", "w", stdout); +} \ No newline at end of file diff --git a/INPUT.TXT b/INPUT.TXT new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/INPUT.TXT @@ -0,0 +1 @@ + diff --git a/OUTPUT.TXT b/OUTPUT.TXT new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/OUTPUT.TXT @@ -0,0 +1 @@ + diff --git a/arifmetik.cpp b/arifmetik.cpp new file mode 100644 index 0000000..215ddac --- /dev/null +++ b/arifmetik.cpp @@ -0,0 +1,16 @@ +//acmp.ru 0008 + +#include + +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"); + } +} \ No newline at end of file diff --git a/basketball.cpp b/basketball.cpp new file mode 100644 index 0000000..050f9fc --- /dev/null +++ b/basketball.cpp @@ -0,0 +1,23 @@ +//acmp.ru 0061 basketball.cpp 5% + +#include + +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"); + } +} \ No newline at end of file diff --git a/binarnie_cisla.cpp b/binarnie_cisla.cpp new file mode 100644 index 0000000..99e6f6d --- /dev/null +++ b/binarnie_cisla.cpp @@ -0,0 +1,19 @@ +//acmp.ru 0692 binarnie_cisla.cpp 8% + +#include +#include +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; +} \ No newline at end of file diff --git a/juravliki.cpp b/juravliki.cpp new file mode 100644 index 0000000..d07150b --- /dev/null +++ b/juravliki.cpp @@ -0,0 +1,13 @@ +//acmp.ru 0092 juravliki.cpp 7% + +#include +#include +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); +} \ No newline at end of file diff --git a/monetki.cpp b/monetki.cpp new file mode 100644 index 0000000..521401c --- /dev/null +++ b/monetki.cpp @@ -0,0 +1,30 @@ +//acmp.ru 0106 moentki.cpp 8% + +#include + +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); + } +} \ No newline at end of file diff --git a/mouse.cpp b/mouse.cpp new file mode 100644 index 0000000..6a54917 --- /dev/null +++ b/mouse.cpp @@ -0,0 +1,17 @@ +//acmp.ru 0907 mouse.cpp 9% + +#include + +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"); + } +} \ No newline at end of file diff --git a/nezemniye_gosti.cpp b/nezemniye_gosti.cpp new file mode 100644 index 0000000..55b5641 --- /dev/null +++ b/nezemniye_gosti.cpp @@ -0,0 +1,16 @@ +//acmp.ru 0597 nezemniye.cpp 10% + +#include + +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"); + } +} \ No newline at end of file diff --git a/ot_perestanovki_shtoto_menyaetsa.cpp b/ot_perestanovki_shtoto_menyaetsa.cpp new file mode 100644 index 0000000..495f41c --- /dev/null +++ b/ot_perestanovki_shtoto_menyaetsa.cpp @@ -0,0 +1,17 @@ +//acmp.ru 0970 ot_perestanovki_shtoto_menyaetsa.cpp 9% + +#include + +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"); + } +} \ No newline at end of file diff --git a/razvorot.cpp b/razvorot.cpp new file mode 100644 index 0000000..5bdf147 --- /dev/null +++ b/razvorot.cpp @@ -0,0 +1,19 @@ +//acmp.ru 0149 razvorot.cpp 9% + +#include + +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]); + } +} \ No newline at end of file diff --git a/sbor_zemlyaniki.cpp b/sbor_zemlyaniki.cpp new file mode 100644 index 0000000..5c102a4 --- /dev/null +++ b/sbor_zemlyaniki.cpp @@ -0,0 +1,17 @@ +//acmp.ru 0755 sbor_zemlyaniki.cpp 6% + +#include + +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); + } +} \ No newline at end of file diff --git a/tort.cpp b/tort.cpp new file mode 100644 index 0000000..15f064a --- /dev/null +++ b/tort.cpp @@ -0,0 +1,20 @@ +//acmp.ru 0539 tort.cpp 6% + +#include + +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"); + } +} \ No newline at end of file diff --git a/tri_tolstyaka.cpp b/tri_tolstyaka.cpp new file mode 100644 index 0000000..6d5a7b7 --- /dev/null +++ b/tri_tolstyaka.cpp @@ -0,0 +1,25 @@ +//acmp.ru 0754 tri_tolstyaka.cpp 7% + +#include + +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; +} \ No newline at end of file diff --git a/vremena_goda.cpp b/vremena_goda.cpp new file mode 100644 index 0000000..673df6a --- /dev/null +++ b/vremena_goda.cpp @@ -0,0 +1,26 @@ +#include + +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; + } +} \ No newline at end of file diff --git a/zolotoy_pesok.cpp b/zolotoy_pesok.cpp new file mode 100644 index 0000000..2872c02 --- /dev/null +++ b/zolotoy_pesok.cpp @@ -0,0 +1,31 @@ +//acmp.ru 0685 zolotoy_pesok.cpp 10% + +#include + +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); +} \ No newline at end of file