LoginSignup
0
0

More than 1 year has passed since last update.

AtCoder B - Count Balls

Posted at

問題


n, a, b = map(int, input().split())
ans = 0

ans = n // (a + b) * a  #商でn内にある青の数

rem = n % (a + b) #あまりで青の数。あまりはかなら

ans += min(rem, a) #余ったボールの数と青いボールの数の小さい方を足す。余ったボールは青いボールから始まる。

print(ans)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0