MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / main

Function main

Codeforces_problems/Even Odds/Solution.cpp:11–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9using namespace std;
10
11int main() {
12
13 long long nums, pos;
14 cin >> nums >> pos;
15 if (nums % 2 == 0) {
16 if (pos > nums / 2) {
17 cout << (pos - (nums / 2)) * 2;
18 }
19 else {
20 cout << pos * 2 - 1;
21 }
22 }
23 else {
24 if (pos > nums / 2+1) {
25 cout << (pos - (nums / 2+1)) * 2;
26 }
27 else {
28 cout << pos * 2 - 1;
29 }
30
31 }
32 return 0;
33}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected