1 solutions
-
0
C :
#include<stdio.h> int main() { long long a,b; while(scanf("%lld%lld",&a,&b)!=EOF) { if(a%2==0) a=a/2; else a=a/2+1; if(b<=a) b=b*2-1; else b=(b-a)*2; printf("%lld\n",b); } return 0; }C++ :
# include <iostream> using namespace std; long long n,k,s; int main(){ for ( ; cin >> n >> k ; cout << s << endl ) s = (k>(n+1)/2) ? ((k-(n+1)/2) * 2) : (k * 2 - 1); return 0; }
- 1
Information
- ID
- 17185
- Time
- 1000ms
- Memory
- 32MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By