Codeforces 1136B. Nastya Is Playing Computer Games
Porblem Link
Solution in c++
#include<bits/stdc++.h>
using namespace std;
/// Typedef
typedef long long ll;
#define sc1(a) scanf("%lld",&a)
#define sc2(a, b) scanf("%lld %lld",&a,&b)
#define pf1(a) printf("%lld\n", a)
#define pf2(a, b) printf("%lld %lld\n",a,b)
#define mx 1000000
#define mod 1000000007
#define PI acos(-1.0)
#define Accepted 0
int main() {
int n, k, res = 0;
cin >> n >> k;
res = 3*n + min(n-k, k-1);
cout << res << endl;
return Accepted;
}
No comments