From 9109f3c1983afb223a7acd8b0529e920519af030 Mon Sep 17 00:00:00 2001 From: Abreu Date: Sat, 11 Sep 2021 15:21:07 -0300 Subject: [PATCH] Organizing files --- 2020/01/.gitignore | 1 + 2020/01/balance.c | 18 +++++++++--------- 2020/01/{ => esboços}/01.c | 0 2020/01/{ => esboços}/d1.c | 0 2020/01/{ => esboços}/etapa0_EX1.c | 0 2020/01/{ => esboços}/funcao_retorna.c | 0 6 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 2020/01/.gitignore rename 2020/01/{ => esboços}/01.c (100%) rename 2020/01/{ => esboços}/d1.c (100%) rename 2020/01/{ => esboços}/etapa0_EX1.c (100%) rename 2020/01/{ => esboços}/funcao_retorna.c (100%) diff --git a/2020/01/.gitignore b/2020/01/.gitignore new file mode 100644 index 0000000..0866082 --- /dev/null +++ b/2020/01/.gitignore @@ -0,0 +1 @@ +balancear diff --git a/2020/01/balance.c b/2020/01/balance.c index 58a379d..929fea2 100644 --- a/2020/01/balance.c +++ b/2020/01/balance.c @@ -1,4 +1,3 @@ -#include #include #include @@ -6,7 +5,7 @@ typedef struct { int no; - float juice, alcohool; + float juice, alcohol; } Barrel; bool readInput(Barrel * line, Barrel * reservoir) { @@ -23,18 +22,19 @@ bool readInput(Barrel * line, Barrel * reservoir) { else { if (f > 1) return false; - line[i / 2].alcohool = f * line[i / 2].juice; - line[i / 2].juice -= line[i / 2].alcohool; + line[i / 2].alcohol = f * line[i / 2].juice; + line[i / 2].juice -= line[i / 2].alcohol; } reservoir->juice = line[0].juice + line[1].juice; - reservoir->alcohool = line[0].alcohool + line[1].alcohool; + reservoir->alcohol = line[0].alcohol + line[1].alcohol; } return true; } void sortLine(Barrel * line) { Barrel aux; - if (line[0].juice + line[0].alcohool > line[1].juice + line[1].alcohool) + + if (line[0].juice + line[0].alcohol > line[1].juice + line[1].alcohol) return; aux = line[0]; line[0] = line[1]; @@ -42,12 +42,12 @@ void sortLine(Barrel * line) { } int loadBarrel (Barrel * reservoir, Barrel b) { - float capacity = b.juice + b.alcohool; + float capacity = b.juice + b.alcohol; if (reservoir->juice - capacity * 0.86 >= -EPSILON - && reservoir->alcohool - capacity * 0.14 >= -EPSILON) { + && reservoir->alcohol - capacity * 0.14 >= -EPSILON) { reservoir->juice -= capacity * 0.86; - reservoir->alcohool -= capacity * 0.14; + reservoir->alcohol -= capacity * 0.14; return b.no; } return 0; diff --git a/2020/01/01.c b/2020/01/esboços/01.c similarity index 100% rename from 2020/01/01.c rename to 2020/01/esboços/01.c diff --git a/2020/01/d1.c b/2020/01/esboços/d1.c similarity index 100% rename from 2020/01/d1.c rename to 2020/01/esboços/d1.c diff --git a/2020/01/etapa0_EX1.c b/2020/01/esboços/etapa0_EX1.c similarity index 100% rename from 2020/01/etapa0_EX1.c rename to 2020/01/esboços/etapa0_EX1.c diff --git a/2020/01/funcao_retorna.c b/2020/01/esboços/funcao_retorna.c similarity index 100% rename from 2020/01/funcao_retorna.c rename to 2020/01/esboços/funcao_retorna.c