From e5f72c3d15d20719073ede44b31da4bb1d9ebafb Mon Sep 17 00:00:00 2001 From: Erge-S <82161070+Erge-S@users.noreply.github.com> Date: Wed, 19 Oct 2022 17:01:31 +0300 Subject: [PATCH] Add files via upload --- Lsn10AlS.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Lsn10AlS.c diff --git a/Lsn10AlS.c b/Lsn10AlS.c new file mode 100644 index 0000000..a7aafa0 --- /dev/null +++ b/Lsn10AlS.c @@ -0,0 +1,54 @@ +#include +#include +#include +#include + +#define T char +#define true 1 == 1 +#define false 1 != 1 +typedef int boolean; + + +int hash(char *S) +{ + int i,r=0; + while(*S) + { + r+=(int)(*S); + S++; + } + return r; +} + +int profitCaculation(int* coin, const int n, const int maxN) { + int arr[n]; + + clearIntArr(arr, n); + + int sum = 0; + int o = 0; + for (int i = 0; i < maxN; i++) { + if ((coin[i]*2) < 98) { + sum += coin[i]; + o++; + } + if (sum < 98) break; + } + return o; +} + +void task2() { + const int Cmax = 5; + const int maxN = 98; + int coin[] = { 50, 10, 5, 2, 1 }; + + printf("%d", profitCaculation(coin, Cmax, maxN)); +} +int main() +{ + + + + return 0; + +} \ No newline at end of file