結果

問題 No.604 誕生日のお小遣い
ユーザー htensaihtensai
提出日時 2019-11-14 11:52:08
言語 Java19
(openjdk 21)
結果
AC  
実行時間 124 ms / 1,000 ms
コード長 396 bytes
コンパイル時間 1,956 ms
コンパイル使用メモリ 71,952 KB
実行使用メモリ 56,576 KB
最終ジャッジ日時 2023-08-14 01:37:24
合計ジャッジ時間 5,882 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,652 KB
testcase_01 AC 121 ms
56,576 KB
testcase_02 AC 123 ms
56,408 KB
testcase_03 AC 122 ms
55,752 KB
testcase_04 AC 121 ms
55,668 KB
testcase_05 AC 121 ms
55,488 KB
testcase_06 AC 122 ms
56,028 KB
testcase_07 AC 123 ms
56,140 KB
testcase_08 AC 121 ms
56,080 KB
testcase_09 AC 121 ms
55,888 KB
testcase_10 AC 122 ms
55,648 KB
testcase_11 AC 123 ms
56,148 KB
testcase_12 AC 124 ms
55,704 KB
testcase_13 AC 123 ms
55,856 KB
testcase_14 AC 122 ms
55,676 KB
testcase_15 AC 122 ms
55,968 KB
testcase_16 AC 122 ms
55,708 KB
testcase_17 AC 122 ms
55,668 KB
testcase_18 AC 122 ms
56,320 KB
testcase_19 AC 122 ms
56,348 KB
testcase_20 AC 122 ms
56,080 KB
testcase_21 AC 119 ms
56,192 KB
testcase_22 AC 118 ms
55,528 KB
testcase_23 AC 123 ms
55,436 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