結果

問題 No.604 誕生日のお小遣い
ユーザー htensaihtensai
提出日時 2019-11-14 11:52:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 123 ms / 1,000 ms
コード長 396 bytes
コンパイル時間 1,952 ms
コンパイル使用メモリ 74,440 KB
実行使用メモリ 54,244 KB
最終ジャッジ日時 2024-05-01 14:41:23
合計ジャッジ時間 5,239 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
53,860 KB
testcase_01 AC 112 ms
53,908 KB
testcase_02 AC 114 ms
53,840 KB
testcase_03 AC 99 ms
52,712 KB
testcase_04 AC 110 ms
53,812 KB
testcase_05 AC 104 ms
52,788 KB
testcase_06 AC 104 ms
54,244 KB
testcase_07 AC 103 ms
52,852 KB
testcase_08 AC 105 ms
54,092 KB
testcase_09 AC 123 ms
53,912 KB
testcase_10 AC 113 ms
52,912 KB
testcase_11 AC 121 ms
53,856 KB
testcase_12 AC 118 ms
53,812 KB
testcase_13 AC 118 ms
54,048 KB
testcase_14 AC 123 ms
53,896 KB
testcase_15 AC 116 ms
53,984 KB
testcase_16 AC 122 ms
54,060 KB
testcase_17 AC 114 ms
52,988 KB
testcase_18 AC 118 ms
53,952 KB
testcase_19 AC 120 ms
53,908 KB
testcase_20 AC 118 ms
53,828 KB
testcase_21 AC 122 ms
53,964 KB
testcase_22 AC 118 ms
54,012 KB
testcase_23 AC 110 ms
52,688 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 money = (a - 1) + b;
		long count = c / money;
		long mod = c % money;
		if (mod >= a) {
		    count++;
		    mod = 0;
		}
		long ans = count * a + mod;
	    System.out.println(ans);
	}
}
0