Problem:


Score : 400 points

Problem Statement

Snuke has one biscuit and zero Japanese yen (the currency) in his pocket.
He will perform the following operations exactly K times in total, in the order he likes:

Hit his pocket, which magically increases the number of biscuits by one.

Exchange A biscuits to 1 yen.

Exchange 1 yen to B biscuits.

Find the maximum possible number of biscuits in Snuke's pocket after K operations.

Constraints

1 \leq K,A,B \leq 10^9

K,A and B are integers.

Input

Input is given from Standard Input in the following format:

K A B

Output

Print the maximum possible number of biscuits in Snuke's pocket after K operations.

Sample Input 1

4 2 6

Sample Output 1

7

The number of biscuits in Snuke's pocket after K operations is maximized as follows:

Hit his pocket. Now he has 2 biscuits and 0 yen.

Exchange 2 biscuits to 1 yen. his pocket. Now he has 0 biscuits and 1 yen.

Hit his pocket. Now he has 1 biscuits and 1 yen.

Exchange 1 yen to 6 biscuits. his pocket. Now he has 7 biscuits and 0 yen.

Sample Input 2

7 3 4

Sample Output 2

8

Sample Input 3

314159265 35897932 384626433

Sample Output 3

48518828981938099



Sample input:
4 2 6


Sample output:
7

Submission status: Wrong Answer

Solution code:
k,a,b=map(int, input().split())

#aaaabできる。ｃが…
if a+3<=b and k>=a+1:
  #
  if a%2==0 and k%2==0:
    print(b+1)
  if a%2==0 and not k%2==0:
    print(2 * b+a)
  if not a%2==0 and k%2==0:
    print(a+1)
  if not a%2==0 and not k%2==0:
    print(2 * b+a)

Submission status: Wrong Answer

Solution code:
k,a,b=map(int, input().split())
 
#aaaabできる。ｃが…
if a+3<=b and k>=a+1:
  #
  if a%2==0 and k%2==0:
    print(b+1)
  if a%2==0 and not k%2==0:
    print(2*b+a)
  if not a%2==0 and k%2==0:
    print(a+1)
  if not a%2==0 and not k%2==0:
    print(2*b+a)

Submission status: Wrong Answer

Solution code:
# import sys
# input = sys.stdin.readline
# import re
import collections
import bisect
import math
import fractions
import collections
import itertools
from functools import reduce

def main():
    k, a, b = input_list()
    if b - a > 2:
        d = min(a - 1, k)
        r = k - d
        ans = (r/2)*(b-a)
        print(ans + (k % 2))
    else:
        print(k+1)


def input_list():
    return list(map(int, input().split()))


def input_list_str():
    return list(map(str, input().split()))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
K, A, B = map(int, input().split())
ans = 0
if B - A <= 2:
  print(K + 1)

else:
  K -= A - 1
  if K <= 1:
    print(K + 1)
  else:
    ans += (K//2) * (B - A) + A
    ans += K % 2
    print(ans)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())
ans = 0

if b//a > 1:
    i = 0
    while ((1+k)-2*i-a*i)>0:
        bis = (1+k)-2*i-a*i + i*b
        ans = max(ans, bis)
        # print(i,bis, ans)
        i += 1
    print(ans)
else:
    print(k+1)

Submission status: Wrong Answer

Solution code:
K,A,B = map(int,input().split())
if A+2 >= B:
    print(1+K)
else:
    beatC,m = divmod((K - (A-1)),2)
    print(beatC*(B-A)+(K - 2 * beatC))

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())
if 2 >= b-a  or a >= k:
    print(k+1)

else:
    print((k-a+1)//2 + ((k-a+1)//2-1)*(b-a) + ((k-a+1)%2))

Submission status: Wrong Answer

Solution code:
K,A,B=map(int,input().split())

if B <= A:
  print(1+K)
  exit()
  
if K<A+1:
  print(1+K)
  exit()

if B - A<=2:
  q,r = divmod(K-1,A)
  print(q*B+r)
  exit()
  
r1 = A-1
K -= r1
q,r = divmod(K,2)
for i in range(q):
  if i == 0:
    res = B
    continue
  q2,res = divmod(res,A)
  res += q2*B
  
print(res+r)

Submission status: Wrong Answer

Solution code:
k,a,b=map(int,input().split())

if a+1<b:
    ans=0
    if k<=a:
        ans=k+1
    else:
        ans=a+1
        k-=a
        if k%2==0:
            ans+=(k//2)*(b-a)
        else:
            ans+=(k//2)*(b-a)+1


    print(ans)


else:
    print(1+k)

Submission status: Wrong Answer

Solution code:
k,a,b=map(int,input().split())

if a+1<b:
    #できるだけbをしたほうが得
    print((k//(a+1))*b+k%(a+1))

else:
    print(1+k)

Submission status: Wrong Answer

Solution code:
k,a,b = map(int,input().split())
if b - a <= 1 or a >= k:
    print(k+1)
else:
    k -= a - 1
    ans = a
    ans += (b - a)*(k//2)
    if k/2 % 2 == 0:
        ans += 1
    print(ans)

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

K, A, B = mapint()
if (B-A)/2<=1:
    print(K+1)
else:
    cnt = A
    rest = K - cnt + 1
    if rest<3:
        print(K+1)
    else:
        if rest%2==0:
            print(cnt+(B-A)*rest//2)
        else:
            rest -= 1
            cnt += 1
            print(cnt+(B-A)*rest//2)

Submission status: Wrong Answer

Solution code:
K,A,B = map(int,input().split())
if B-A-2 <= 0:
  print(K+1)
  exit()

if K-1 <= A:
  print(K+1)
  exit()
  
K -= (A-1)
num = K//2
nokori = K%2
#print(K,num,nokori)
ans = A+num*(B-A)+nokori
print(ans)

Submission status: Wrong Answer

Solution code:
K,A,B= map(int, input().split())

if A + 2 >= B or K < A + 2:
    print(K + 1)

else:
    K -= A - 1
    q, m = divmod(K, 2)
    print((B - A) * q + A + m)

Submission status: Wrong Answer

Solution code:
K,A,B=map(int,input().split())
answer1=1+K
answer2=((K+1)//(A+2))*B+(K+1)%(A+2)
print(max(answer1,answer2))

Submission status: Wrong Answer

Solution code:
K, A, B = map(int, input().split())

if A >= B+2:
    print(K+1)
else:
    ans = 1 + (K-A+1) * ((B-A) // 2) + (B-A)%2 
    print(max(K+1,ans))

Submission status: Wrong Answer

Solution code:
k,a,b = map(int,input().split())
cokie = 1
if b < a:
    cokie += k
    print(cokie)
else:
    if k < a+2 or b-a < 2:
        cokie += k
        print(cokie)
    else:
        cokie += a-1
        k -= a-1
        b_a = k//2
        hit = k%2
        cokie += b_a*(b-a) + hit 
        print(cokie)

Submission status: Wrong Answer

Solution code:
K, A, B = map(int, input().split())

ans = 0
if K % 2 == 0:
  ans = max(K+1, K//2*(B-A) - (A-1))
else:
  ans = max(K+1, (K-1)//2 *(B-A) - A)

print(ans)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())

if b/a <= 2 or k-(a-1) <= 0:
    ans = 1 + k
else:
    k = k - (a-1)
    ans=(b-a) * ((k//2)-1) + b + k%2
print(int(ans))

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())
  
if b/a <= 2 or k-(a-1) <= 0:
    ans = 1 + k
else:
    k = k - (a-1)
    ans=(b-a) * ((k//2) -1) + b * (k//2) + k%2

print(int(ans))

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split()) 
biscet = 1

rate = (b-a)/2

if ( rate > 1):
    k-=(a-1)
    biscet+=(a-1)
    biscet += int(k/2) * (b-a)
    biscet += k%2
    
else:
    biscet += k

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())
now = 1

if b - a <= 2: print(k + 1)
else:
    c, d = divmod(k + 1, a + 2)
    print(b * c + d)

Submission status: Wrong Answer

Solution code:
K, A, B = map(int, input().split())
if B - A <= 2  or K <= A:
  print(K + 1)
else:
  print(A + ((K - A + 1) // 2) * (B - A)  + ((K - A + 1) // 2))

Submission status: Wrong Answer

Solution code:
K, A, B = map(int, input().split())
if A >= B or K <= A:
  print(K + 1)
else:
  print(A + ((K - A + 1) // 2) * (B - A)  + ((K - A + 1) // 2))

Submission status: Wrong Answer

Solution code:
K, A, B = map(int, input().split())

if(B-A <= 2):
    print(K+1)
else:
    m = max(0, K-(A-1)//2)*(B-A)+(K+1)-2*max(0, K-(A-1)//2)
    print(m)

Submission status: Wrong Answer

Solution code:
k,a,b=map(int,input().split())
ans=0
k+=1
if a>b+1:
    ans=k
else:
    if a+2>k:
        ans=k
    else:
        ans+=b
        k-=a+2
        ans+=(b-a)*(k//2)
        ans+=k%2
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from collections import deque
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

k,a,b = readInts()

if a+2<b:
	ans = (k+1)//(a+2)*b + (k+1)%(a+2)
else:
	ans = k+1

print(ans)

Submission status: Wrong Answer

Solution code:
k,a,b=map(int,input().split())
import sys

if k <a or b-a <2:
  print(k+1)
  sys.exit()
if (k-a) %2 ==0:
  print(a+(b-a)*(k-a)//2+1)
else:
  print(a+(b-a)*((k-a)//2-1)+2)

Submission status: Wrong Answer

Solution code:
k,a,b=map(int,input().split())
if b<a+2:
    print(1+k)
else:
    if k<=a:
        print(1+k)
    else:
        if (k-a-1)%2==0:
            print(b+(b-a)*(k-a-1)//2)
        else:
            print(b+(b-a)*(k-a-1)//2)

Submission status: Wrong Answer

Solution code:
k,a,b=map(int,input().split())
if b<a+2:
    print(1+k)
else:
    if k<=a:
        print(1+k)
    else:
        if k%2==1:
            if (k-a-1)%2==0:
                print(b+(b-a)*(k-a-1)//2)
            else:
                print(b+(b-a)*(k-a-1)//2+1)
        else:
            if (k-a-1)%2==0:
                print(b+(b-a)*(k-a-1)//2+1)
            else:
                print(b+(b-a)*(k-a-1)//2)

Submission status: Wrong Answer

Solution code:
k,a,b=map(int,input().split())
if b<a+2:
    print(1+k)
else:
    if k<=a:
        print(1+k)
    else:
        if (k-a-1)%2!=0:
            print(b+(b-a)*(k-a-1)//2+1)
        else:
            print(b+(b-a)*(k-a-1)//2)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())
if a+ 1 >= b:
    ans = k + 1
else:
    if a > k:
        ans = k + 1
    else:
        ans = a
        k -= (a - 1)
        if k % 2 == 0:
            ans += k/2 * (b - a)
        else:
            ans += k//2 * (b - a)
            ans += 1

print(int(ans))

Submission status: Wrong Answer

Solution code:
def main():
    K, A, B = map(int, input().split())
    ans = 0

    if A >= B:
        ans = K + 1
    else:

        if abs(A - B) <= 2:
            ans = K + 1

        else:
            if K >= A - 1 + 2:
                ans += B
                K -= (A + 1)

                if abs(A - B) <= 2:
                    r, m = divmod(K, A)
                    ans += r * B + m
                else:
                    r, m = divmod(K, 2)
                    ans += (B - A) * r + m

    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    K, A, B = map(int, input().split())
    ans = 0

    if A >= B:
        ans = K + 1
    else:
        if K >= A - 1 + 2:
            ans += B
            K -= A + 1

            if abs(A - B) <= 2:
                r, m = divmod(K, A)
                ans += r * B + m
            else:
                r, m = divmod(K, 2)
                ans += (B - A)* r + m

        else:
            ans += K + 1

    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
K, A, B = map(int, input().split())
if A >= B:
  ans = K+1
else:
  if K-A-1 < 0:
    n = 0
    ans = K+1
  else:
    n = (K-A-1)//2
    m = (K-A-1)%2
    ans = n*(B-A) + m + B
print(ans)

Submission status: Wrong Answer

Solution code:
k,a,b=map(int,input().split())
bis=1
coin=0
if b-a<=2:
    print(k+1)
else:
    print(((k-(a-1)-2)//(a+2))*b+((k-(a-1)-2)%(a+2))+b)

Submission status: Wrong Answer

Solution code:
k,a,b=map(int,input().split())
cnt=0
if b<a+2:
    print(k+1)
else:
    if k>=a+1:
        k-=a+1
        cnt+=b
        q,modulo=divmod(k,2)
        cnt+=q*b-q*a+modulo
        print(cnt)
    else:
        print(k)

Submission status: Wrong Answer

Solution code:
k,a,b=map(int,input().split())
cnt=1
yen=0

if b<a+2:
    print(k+1)

else:
    if k>=a+1:
        k-=a+1
        cnt+=b
        q,modulo=divmod(k,a+2)
        cnt+=q*b+modulo
        print(cnt)
    else:
        print(k)

Submission status: Wrong Answer

Solution code:
k,a,b = map(int,input().split())
if a >= b+2:
  print(k+1)
else:
  d = k-(a-1)
  e = a
  e += (b-a)*(d//2)
  e += d%2
  print(e)

Submission status: Wrong Answer

Solution code:
k,a,b = map(int,input().split())
if a >= b+2:
  print(k+1)
else:
  d = k-(a-1)
  e = a
  e += (b-a)*d//2
  e += d%2
  print(e)

Submission status: Wrong Answer

Solution code:
K,A,B = map(int,input().split())

if B-A < 3:
  print(1+K)
  exit()

ans = 1

N = K - (A-1)

ans += (B-A)*max(0,N//2) + N%2

print(ans)

Submission status: Wrong Answer

Solution code:
K,A,B = map(int,input().split())

if B-A < 3:
  print(1+K)
  exit()

ans = 1
ans += (K//(A+2))*B

if K%(A+2) == A+1:
  ans += B
else:
  ans += K%(A+2)
  

print(ans)

Submission status: Wrong Answer

Solution code:
K, A, B = map(int, input().split())

if K == 1:
    print(2)
elif K == 2:
    if A == 1 and B >= 2:
        print(B)
    else:
        print(2)
else:
    ans = 1
    # 変換したほうが得なら変換する
    if A < B:
        # A枚を1円に変換、1円をB枚に変換で行動件を2回使うので2で割る
        cnt, amari = divmod(K-(A-1), 2)
        ans = A+cnt*(B-A)+amari
    else:
        ans += K
    print(ans)

Submission status: Wrong Answer

Solution code:
K, A, B = map(int, input().split())
ans = 0
if B>A+1:
  if K>=A+1:
    ans += B
    K -= A+1
  k = K//2
  ans += (B-A)*k
  ans += K%2
else:
  ans = K+1

print(ans)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())

if a >= b-1:
    print(k+1)
else:
    if k <= a:
        print(k+1)
    else:
        if k-a % 2 == 1:
            print((k-a+1)//2*(b-a)+a)
        else:
            print((k-a)//2*(b-a)+a+1)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

k, a, b = [int(x) for x in input().split()]

biscuits = 0

if a + 1 > k or a >= b:
    print(k)
    sys.exit()

biscuits += b
k -= (a + 1)
biscuits += (b - a) * (k // 2) + (k % 2)

print(biscuits)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())

if a >= b-1:
    print(k+1)
else:
    if k <= a:
        print(k+1)
    else:
        if k-a % 2 == 1:
            print((k-a)//2*(b-a)+a)
        else:
            print((k-a)//2*(b-a)+a+1)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())
if k > a+1 and b > a+1:
    x = 1 + k
    t = (k-a+1)//2
    y = t * (b-a) + (k-t*2) + 1
    print(max(x,y))
    exit()
else:
    z = 1 + k
    print(z)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())
if k > a+1 and b > a:
    x = 1 + k
    t = (k-a+1)//2
    y = t * (b-a) + (k-t*2) + 1
    print(y)
    exit()
else:
    z = 1 + k
    print(z)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())
if k > a+2 and b > a:
    x = 1 + k
    t = (k-a+1)//2
    y = t * (b-a) + (k-t*2) + 1
    print(max(x,y))
    exit()
else:
    z = 1 + k
    print(z)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())
if k > a+1 and b > a:
    x = 1 + k
    t = (k-a+1)//2
    y = t * (b-a) + (k-t*2) + 1
    print(max(x,y))
    exit()
else:
    z = 1 + k
    print(z)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())
if 2 >= b - a or k+1 <= a:
    print(k+1)
else:
    i = (k-a+1)//2+1
    ans = k+1 -a*i + b*i -2*i
    print(ans)

Submission status: Wrong Answer

Solution code:
K,A,B = map(int,input().split())

if K < A+2 or B <= A+2:
  print(K+1)
  exit(0)
  
K -= A - 1
ans = A
p,q = divmod(K,2)
ans += (B-A) * p + q
print(ans)

Submission status: Wrong Answer

Solution code:
K,A,B = map(int,input().split())

if K < A+2 or B <= A+2:
  print(K+1)
  exit(0)
  
K -= A - 1
p,q = divmod(K,2)
ans = (B-A) * p + q
print(ans)

Submission status: Wrong Answer

Solution code:
K,A,B = map(int,input().split())

if B <= A+2:
  print(K+1)
  exit(0)
  
K -= A - 1
p,q = divmod(K,2)
ans = B * p + q
print(ans)

Submission status: Wrong Answer

Solution code:
K,A,B = map(int,input().split())

if K < (A+B+2) or B <= A+2:
  print(K+1)
  exit(0)
  
K -= A - 1
p,q = divmod(K,2)
ans = B * p + q
print(ans)

Submission status: Wrong Answer

Solution code:
K,A,B = map(int,input().split())

ans = K + 1

K += 1
t = (K // (A+2)) * B
t += K % (A+2)

print(max(t,ans))

Submission status: Wrong Answer

Solution code:
K,A,B = map(int,input().split())

if A < B:
  ans = 0
  K += 1
  while A < K:
    K -= A
    K -= 1
    ans += B
  ans += K
  print(ans)
else:
  print(K+1)

Submission status: Wrong Answer

Solution code:
K,A,B = map(int,input().split())

if A < B:
  print(A)
else:
  print(K+1)

Submission status: Wrong Answer

Solution code:
K,A,B = map(int,input().split())
ans = K + 1

t = ((K+1) // (A+1)) * B
t += (K+1) % (A+1)
ans = max(ans,t)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    k,a,b=map(int, input().split())
    ans=0
    if b-1>a+1 and k>=a+1:
        k-=a+1
        ans+=b
        ans+=k//2*(b-a)
        if k==1:
            ans+=1
        print(ans)

    else:
        print(1+k)

resolve()

Submission status: Wrong Answer

Solution code:
K, A, B = [int(_) for _ in input().split()]

bis = 1
upbis = 0
k = 0
ma = 1 + K

while K >= k + (A-bis) + 2:
    k += (A-bis) + 2
    upbis += B
    bis = 0
    print(K, k, upbis)
upbis += K - k

print(max(ma, upbis))

Submission status: Wrong Answer

Solution code:
K,A,B = map(int, input().split())

bsk=1
en=0
ct=0

if B < A:
    for i in range(K):
        bsk += 1
        exit()
if B > A:
    if K < A:
        for i in range(K):
            bsk += 1
    else:
        while ct < K-1:
            bsk += 1
            ct += 1
            if bsk == A and ct < K-1:
                bsk = 0
                en += 1
                ct += 1

        bsk += (B*en)

print(bsk)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())
if b - a <= 2 or a >= k:
    print(k + 1)
else:
    cnt = max(0, k - (a - 1))
    print((b - a) * cnt // 2 + 1 * cnt % 2 + min(k, a))

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())
if b - a <= 2 or a >= k:
    print(k + 1)
else:
    cnt = k - (a - 1)
    print((b - a) * cnt // 2 + 1 * cnt % 2 + a)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())
if b - a <= 2:
    print(k + 1)
else:
    cnt = k - (a - 1)
    print(max(k + 1, (b - a) * cnt // 2 + 1 * cnt % 2 + a))

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())
if b - a <= 2:
    print(k + 1)
elif b - a > 2:
    cnt = k - (a - 1)
    print((b - a) * cnt // 2 + 1 * cnt % 2 + a)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())
if b - a < 2:
    print(k + 1)
elif b - a > 2:
    cnt = k - (a - 1)
    print((b - a) * cnt // 2 + 1 * cnt % 2 + a)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())
print(k)
print(a)
print(b)
if b - a < 2:
    print(k + 1)
elif b - a > 2:
    cnt = k - (a - 1)
    print((b - a) * cnt // 2 + 1 * cnt % 2 + a)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())

if k < (a + 2) or (b - a) <= 2:
    print(1 + k)
else:
    cnt = (k - (a - 1)) // 2
    mod = (k - (a - 1)) % 2
    ans = (b - a)*cnt + a + mod
    print(max(ans, k + 1))

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())

if k < (a + 2) or (b - a) <= 2:
    print(1 + k)
else:
    cnt = (k - (a - 1)) // 2
    mod = (k - (a - 1)) % 2
    ans = (b - a)*cnt + a + mod
    print(ans)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())

if k == 1:
    print(2)
elif k < (a + 2) or (b - a) <= 2:
    print(1 + k)
else:
    cnt = (k - (a - 1)) // 2
    mod = (k - (a - 1)) % 2
    ans = (b - a)*cnt + a + mod
    print(ans)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())

if k == 1:
    print(2)
elif k < a + 2 or b - a <= 2:
    print(1 + k)
else:
    cnt = (k - (a - 1)) // 2
    mod = (k - (a - 1)) % 2
    ans = (b - a)*cnt + a + mod
    print(ans)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())

if k == 1:
    print(2)
elif k < a + 2 or a >= b:
    print(1 + k)
else:
    cnt = (k - (a - 1)) // 2
    mod = (k - (a - 1)) % 2
    ans = (b - a)*cnt + a + mod
    print(ans)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())

if k == 1:
    print(2)
elif k < a + 2 or a >= b:
    print(1 + k)
else:
    cnt = (k - (a - 1)) // 2
    mod = (k - (a - 1)) % 2
    ans_1 = (b - a)*cnt + a + mod
    ans_2 = 1 + k
    print(int(max(ans_1, ans_2)))

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())

if k == 1:
    print(2)
elif k < a + 2:
    print(1 + k)
else:
    cnt = (k - (a - 1)) // 2
    mod = (k - (a - 1)) % 2
    ans_1 = (b - a)*cnt + a + mod
    ans_2 = 1 + k
    print(int(max(ans_1, ans_2)))

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())
if b - a <= 1 or k < a + 2:
    print(k + 1)
else:
    print(((k - a + 1) // 2) * (b - a) + a + (k - a + 1) % 2)

Submission status: Wrong Answer

Solution code:
K,A,B=map(int,input().split())

if B - A <= 2:
    print(K+1)
elif K < A:
    print(K+1)
elif A % 2 == 0:
    print(B+(B-A)*((K-A-2)//2)+1)
else:
    print(B+(B-A)*((K-A-1)//2))

Submission status: Wrong Answer

Solution code:
K, A, B = map(int, input().split())

bisket = 1
money = 0

if B / A > 2:
    remain = K - A + 1
    bisket = A
    bisket += remain // 2 * (B - A)
    if remain % 2 == 1:
        bisket += 1
else:
    bisket += K

print(bisket)

Submission status: Wrong Answer

Solution code:
k,a,b = map(int, input().split())
res = 1
if b <= a + 1:
  print(res + k)
else:
  if k < a - 1 + 2:
    print(res + k)
  else:
    res += b - 1
    k -= a + 1
    if k < a + 2:
      print(res + k)
    else:
      print(res + k//2 * (b - a) + k % 2)

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
input = sys.stdin.readline
k,a,b = map(int,input().split())

if b-a<=2 or k <a:
    print(k+1)
    sys.exit()
else:
    if k-(a-1) %2==0 :
        ans = a + ((k-a+1)//2)*(b-a)
    else:
        ans = a +1  + ((k-a+1)//2)*(b-a)
    print(ans)

Submission status: Wrong Answer

Solution code:
arr = input().split()
K = int(arr[0])
A = int(arr[1])
B = int(arr[2])

n = 1 + K

x = 1 # ビスケットの枚数
if K > (A+1):
	# 一回だけ Aを1円, 1円をBにする操作を行う
	x = B
	K -= A+1 # (A - 1) + 2

	# ここで、K は必ず A より大きいので、
	# 残りの K回 のうち、何回 「Aを1円, 1円をBにする操作」ができるか計算する
	temp = int(K / 2)

	x += temp * (B-A) # x に 差分だけ加算
	# K -= temp * 2 # 元々は二回やっていた操作なので、二倍して元々の操作回数を K から引く

	# 200 50 100
	# K -= 51 => 149
	# x = 100
	# temp = 149 / 2 => 74
	# x += 100 + 74 * (100 - 50) => 3800
	x += (K - temp * 2)
	# K -= 74 * 2 => 149 - 148 => 1
	# while K > 0:
	# 	K -= 1
	# 	x += 1

print(max(x, n))

Submission status: Wrong Answer

Solution code:
arr = input().split()
K = int(arr[0])
A = int(arr[1])
B = int(arr[2])

n = 1 + K

x = 1 # ビスケットの枚数
if K > (A+1):
	# 一回だけ Aを1円, 1円をBにする操作を行う
	x = B
	K -= A+1 # (A - 1) + 2

	# ここで、K は必ず A より大きいので、
	# 残りの K回 のうち、何回 「Aを1円, 1円をBにする操作」ができるか計算する
	temp = int(K / 2)

	# x += temp * (B-A) # x に 差分だけ加算
	# K -= temp * 2 # 元々は二回やっていた操作なので、二倍して元々の操作回数を K から引く

	# 200 50 100
	# K -= 51 => 149
	# x = 100
	# temp = 149 / 2 => 74
	# x += 100 + 74 * (100 - 50) => 3800
	x += temp * (B-A) + (K - temp * 2)
	# K -= 74 * 2 => 149 - 148 => 1
	# while K > 0:
	# 	K -= 1
	# 	x += 1

print(max(x, n))

Submission status: Wrong Answer

Solution code:
arr = input().split()
K = int(arr[0])
A = int(arr[1])
B = int(arr[2])

n = 1 + K

x = B
K -= A+1

temp = int(K / 2)

x += temp * (B-A)
K -= temp * 2

while K > 0:
	K -= 1
	x += 1

print(max(x, n))

Submission status: Wrong Answer

Solution code:
arr = input().split()
K = int(arr[0])
A = int(arr[1])
B = int(arr[2])

n = 1 + K

x = B
K -= A+1

temp = int(K / 2)

x += temp * abs(B-A)
K -= temp * 2

while K > 0:
	K -= 1
	x += 1

print(max(x, n))

Submission status: Wrong Answer

Solution code:
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7



def main():
    K, A, B = map(int, readline().split())
    ans = 1
    if A+2>=B:
        ans += K
    else:
        if K<A+2:
            ans += K
        else:
            ans += A-1
            ans += ((K-A+1)//2)*(B-A)
            ans += (K-A+1)%2
    print(ans)




if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
K, A, B = map(int, input().split())

ans = 1
if A < B + 2:
    if K - 1 > A:
        ans += A - 1
        K -= A - 1
        ans += (B-A) * (K//2)
        ans += K % 2  
    else:
        ans += K
else:
    ans += K

print(ans)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())

if abs(b-a) <= 2:
    print(1+k)
    exit()
    
check = 0
ans = 1

while True:
    if check == 0:
        if (k-2) >= a-1:
            k = k-2-(a-1)
            ans -= 1
            ans += b
            check = 1
            continue
        else:
            ans += k
            break
    else:
        if k % 2 == 0:
            s = k//2
            ans -= a * s
            ans += b * s
        else:
            s = k//2
            ans -= a * s
            ans += b * s + 1
    break

print(ans)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())
ans = 0
if a >= b:
    ans += k+1
else:
    if k <= a:
        ans += k+1
    else:
        ans += a
        k -= a - 1
        if k % 2 == 1:
            ans += 1
            k -= 1
        ans += (k // 2)*(b - a)


        # ans = max(ans, k+1)

print(int(ans))

Submission status: Wrong Answer

Solution code:
k,a,b = map(int,input().split())
dif = b-a
if b<=2:
  print(k+1)
else:
  ans = a
  k -= (a-1)
  ans += dif*(k//2)
  ans += (k%2==1)
  print(ans)

Submission status: Wrong Answer

Solution code:
k,a,b = map(int,input().split())
dif = b-a
if b<=2:
  print(k)
else:
  ans = dif*(k//2)
  ans += (k%2==1)
  print(ans)

Submission status: Wrong Answer

Solution code:
row_data = input().split()
trial_data = int(row_data[0])
change_coin = int(row_data[1])
change_buiscuit = int(row_data[2])

if change_coin - change_buiscuit >= -1:
  print(int(trial_data+1))
else:
  residual = trial_data - change_coin + 1
  if residual % 2 == 0:
    if residual <= 1:
      print(int(change_buiscuit))
    else:
      print(int(((residual-2)/2) * (change_buiscuit - change_coin) + change_buiscuit))
  else:
    if residual <= 1:
      print(int(change_buiscuit + 1))
    else:
      print(int(((residual-3)/2) * (change_buiscuit - change_coin)+ change_buiscuit + 1))

Submission status: Wrong Answer

Solution code:
K,A,B=list(map(int,input().split()))
hand=0
if B-A<=2:
    print(K+1)
    exit()
K=K-A+1
print(K)
if K%2==1:
    hand=1+int((K-1)/2)*(B-A)
else:
    hand=int(K/2)*(B-A)
print(hand+A)

Submission status: Wrong Answer

Solution code:
k,a,b=map(int,input().split())
if b/a<=2 or k-1<=a:
    print(1+k)
else:
    print((k-a+1)//2*(b-a)+(k-a+1)%2+a)

Submission status: Wrong Answer

Solution code:
k,a,b=map(int,input().split())
if b/a<=2 or k-1<a:
    print(1+k)
else:
    print((k-a+1)//2*(b-a)+(k-a+1)%2+a)

Submission status: Wrong Answer

Solution code:
row_data = input().split()
trial_data = int(row_data[0])
change_coin = int(row_data[1])
change_buiscuit = int(row_data[2])

if change_coin - change_buiscuit >= -1:
  print(int(trial_data+1))
else:
  residual = trial_data - change_coin - 1
  if residual % 2 == 0:
    if residual <= 1:
      print(int(change_buiscuit))
    else:
      print(int(change_buiscuit + (residual/2-1) * (change_buiscuit - change_coin)))
  else:
    if residual <= 1:
      print(int(change_buiscuit + 1))
    else:
      print(int(((residual-1)/2-1) * (change_buiscuit - change_coin) + 1))

Submission status: Wrong Answer

Solution code:
def myAnswer(K:int,A:int,B:int) -> int:
   if(K - (A - 1)) < 0: return K+1
   if((B - A) > A):
      counter = (K - (A - 1)) // 2
      total = (counter * B) - (counter * A) + A
      # print(counter,total)
      if(K - (A - 1)) % 2 == 1:
         total += 1
   else:
      total = K + 1
   return total

def modelAnswer():
   return
def main():
   K,A,B = map(int,input().split())
   print(myAnswer(K,A,B))
if __name__ == '__main__':
   main()

Submission status: Wrong Answer

Solution code:
def myAnswer(K:int,A:int,B:int) -> int:
   if((B - A) > A):
      counter = (K - (A - 1)) // 2
      total = (counter * B) - (counter * A) + A
      # print(counter,total)
      if(K - (A - 1)) % 2 == 1:
         total += 1
   else:
      total = K + 1
   return total

def modelAnswer():
   return
def main():
   K,A,B = map(int,input().split())
   print(myAnswer(K,A,B))
if __name__ == '__main__':
   main()

Submission status: Wrong Answer

Solution code:
def myAnswer(K:int,A:int,B:int) -> int:
   if((B - A) > A+1):
      counter = (K - (A - 1)) // 2
      total = (counter * B) - (counter * A) + A
      # print(counter,total)
      if(K - (A - 1)) % 2 == 1:
         total += 1
   else:
      total = K + 1
   return total

def modelAnswer():
   return
def main():
   K,A,B = map(int,input().split())
   print(myAnswer(K,A,B))
if __name__ == '__main__':
   main()

Submission status: Wrong Answer

Solution code:
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
K,A,B = map(int,input().split())

ans1 = 1 + K
zanturn = K - (A - 1)
AtoB,mod = divmod(zanturn,2)
ans2 = A + (B-A)*AtoB + mod

print(ans1,ans2)
ans = max(ans1,ans2)

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())

if b - 2 <= a or k <= a + 1:
    print(k + 1)
else:
    r = k - (a - 1)
    print((r // 2 - 1) * (b - a) + b + r % 2)

Submission status: Wrong Answer

Solution code:
K,A,B=map(int, input().split())
if A+2>=B:
  print(K+1)
else:
  if K==1 or K<=A+1:
    print(K+1)
  else:
    cnt=0
    K-=(A-1)
    a=K//2
    cnt=a*(B-A)+A
    if K%2==1:
      cnt+=1
    print(cnt)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int,input().split())

if b - a <= 2:
    print(k+1)
else:
    if ((k-(a-1))//2) <= 2:
        print(((k-(a-1))//2)*(b)+((k-(a-1))//2)%2)
    else:
        print(((k-(a-1))//2)*(b-a)+((k-(a-1))//2)%2)

Submission status: Wrong Answer

Solution code:
k, a, b = map(int,input().split())

if b - a <= 2:
    print(k+1)
else:
    if ((k-(a-1))//2) == 1:
        print(((k-(a-1))//2)*(b)+((k-(a-1))//2)%2)
    else:
        print(((k-(a-1))//2)*(b-a)+((k-(a-1))//2)%2)

Submission status: Wrong Answer

Solution code:
K, A, B = map(int, input().split())
if B - A <= 2 :
  print(K + 1)
elif K < A + 1:
  print(K + 1)
elif K == A + 1:
  print(B)

Submission status: Wrong Answer

Solution code:
K, A, B = map(int, input().split())
if B - A <= 2 :
  print(K + 1)
elif K < A + 1:
  print(K + 1)
elif K == A + 1:
  print(B)
else:
  count = K - (A + 1)
  if count % 2 == 1:
    ans = count // 2 * (B - A) + B
  else:
    ans = count//2 * (B - A) + B + 1
  print(ans)

Submission status: Wrong Answer

Solution code:
K, A, B = map(int, input().split())
if B - A <= 2 :
  print(K + 1)
elif K < A + 1:
  print(K + 1)
elif K == A + 1:
  print(B)
else :
  count = K - (A + 1)
  if count % 2 == 1:
    ans = count // 2 * (B - A) + B
  else:
    ans = count//2 * (B - A) + B + 1
  print(ans)