結果

問題 No.604 誕生日のお小遣い
ユーザー takeya_okinotakeya_okino
提出日時 2019-08-04 16:15:50
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 1,000 ms
コード長 405 bytes
コンパイル時間 1,779 ms
コンパイル使用メモリ 73,456 KB
実行使用メモリ 41,796 KB
最終ジャッジ日時 2024-05-01 14:40:36
合計ジャッジ時間 5,259 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
41,796 KB
testcase_01 AC 102 ms
41,516 KB
testcase_02 AC 121 ms
41,788 KB
testcase_03 AC 109 ms
41,788 KB
testcase_04 AC 103 ms
41,296 KB
testcase_05 AC 104 ms
41,196 KB
testcase_06 AC 116 ms
41,768 KB
testcase_07 AC 112 ms
41,256 KB
testcase_08 AC 94 ms
41,392 KB
testcase_09 AC 96 ms
41,300 KB
testcase_10 AC 124 ms
41,108 KB
testcase_11 AC 127 ms
41,596 KB
testcase_12 AC 113 ms
41,704 KB
testcase_13 AC 125 ms
41,412 KB
testcase_14 AC 120 ms
41,184 KB
testcase_15 AC 108 ms
41,120 KB
testcase_16 AC 102 ms
41,492 KB
testcase_17 AC 110 ms
41,300 KB
testcase_18 AC 116 ms
41,464 KB
testcase_19 AC 107 ms
41,192 KB
testcase_20 AC 116 ms
41,548 KB
testcase_21 AC 113 ms
41,508 KB
testcase_22 AC 118 ms
41,508 KB
testcase_23 AC 111 ms
41,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long a = sc.nextLong();
    long b = sc.nextLong();
    long c = sc.nextLong();
    long ans = (c / (a - 1 + b)) * a;
    long r = c - (c / (a - 1 + b)) * (a - 1 + b);
    if(r <= (a - 1)) {
      ans += r;
    } else {
      ans += a;
    }
    System.out.println(ans);
  }
}
0