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; +}