From 053fb458ced032bb1c794927b2a4497c0f3378f6 Mon Sep 17 00:00:00 2001 From: fzorb Date: Thu, 8 May 2025 18:42:16 +0300 Subject: [PATCH] + 390 --- .gitignore | 3 +++ 390/solutie.cpp | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 390/solutie.cpp diff --git a/.gitignore b/.gitignore index 1e19735..b82e541 100644 --- a/.gitignore +++ b/.gitignore @@ -252,3 +252,6 @@ dkms.conf a.out *.swp +a.exe +*.in +*.out diff --git a/390/solutie.cpp b/390/solutie.cpp new file mode 100644 index 0000000..17a7b14 --- /dev/null +++ b/390/solutie.cpp @@ -0,0 +1,18 @@ +#include + +using namespace std; + +ifstream fin("planta.in"); +ofstream fout("planta.out"); + +int main() { + int d,a,b,n,i; + fin >> d >> a >> b >> n; + int z = n / 2; + d = d + a * z - b * z; + if (n % 2 == 1) { + d = d + a; + } + fout << d; + return 0; +}