結果

問題 No.604 誕生日のお小遣い
ユーザー tentententen
提出日時 2020-09-05 23:45:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 1,000 ms
コード長 435 bytes
コンパイル時間 4,526 ms
コンパイル使用メモリ 71,304 KB
実行使用メモリ 56,192 KB
最終ジャッジ日時 2023-08-19 13:16:02
合計ジャッジ時間 9,344 ms
ジャッジサーバーID
(参考情報)
judge10 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,524 KB
testcase_01 AC 125 ms
55,928 KB
testcase_02 AC 127 ms
55,796 KB
testcase_03 AC 123 ms
55,604 KB
testcase_04 AC 124 ms
55,708 KB
testcase_05 AC 126 ms
56,128 KB
testcase_06 AC 124 ms
55,896 KB
testcase_07 AC 124 ms
55,600 KB
testcase_08 AC 125 ms
55,764 KB
testcase_09 AC 127 ms
55,400 KB
testcase_10 AC 126 ms
55,824 KB
testcase_11 AC 126 ms
55,772 KB
testcase_12 AC 127 ms
56,192 KB
testcase_13 AC 127 ms
55,624 KB
testcase_14 AC 127 ms
55,392 KB
testcase_15 AC 126 ms
55,696 KB
testcase_16 AC 125 ms
55,744 KB
testcase_17 AC 126 ms
55,548 KB
testcase_18 AC 125 ms
55,936 KB
testcase_19 AC 124 ms
55,696 KB
testcase_20 AC 126 ms
55,548 KB
testcase_21 AC 125 ms
55,632 KB
testcase_22 AC 126 ms
55,580 KB
testcase_23 AC 126 ms
56,016 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 times = c / (a - 1 + b);
    	long mod = c % (a - 1 + b);
    	long ans;
    	if (mod < a) {
    	    ans = times * a + mod;
    	} else {
    	    ans = (times + 1) * a;
    	}
    	System.out.println(ans);
	}
}
0