+ 390
This commit is contained in:
parent
292c95eaca
commit
053fb458ce
2 changed files with 21 additions and 0 deletions
18
390/solutie.cpp
Normal file
18
390/solutie.cpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include <fstream>
|
||||
|
||||
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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue