Răspuns :
#include <iostream>
using namespace std;
long long int p,k;
int main()
{
cin>>p>>k;
long long int j=k/2;
if(k%2)
cout<<p+j*30;
else
cout<<p+j*10+(j-1)*20;
return 0;
}
Iti trimit sursa mea in C++, diferita de cea de mai sus . Succes!
#include <bits/stdc++.h>
using namespace std;
long long p, k, n, x;
int main()
{
cin >> p >> k;
k --;
x = k / 10;
k = k % 10;
n = x * 150;
if (k % 2 == 0) n = n + ((k / 2) * 30);
else n = n + ((k / 2)* 30) + 10;
cout << n + p;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long p, k, n, x;
int main()
{
cin >> p >> k;
k --;
x = k / 10;
k = k % 10;
n = x * 150;
if (k % 2 == 0) n = n + ((k / 2) * 30);
else n = n + ((k / 2)* 30) + 10;
cout << n + p;
return 0;
}