結果

問題 No.604 誕生日のお小遣い
ユーザー GrenacheGrenache
提出日時 2017-12-10 16:08:26
言語 Java21
(openjdk 21)
結果
AC  
実行時間 109 ms / 1,000 ms
コード長 771 bytes
コンパイル時間 3,022 ms
コンパイル使用メモリ 72,428 KB
実行使用メモリ 56,484 KB
最終ジャッジ日時 2023-08-14 01:27:08
合計ジャッジ時間 6,637 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
56,116 KB
testcase_01 AC 105 ms
56,060 KB
testcase_02 AC 106 ms
56,308 KB
testcase_03 AC 104 ms
56,100 KB
testcase_04 AC 103 ms
55,768 KB
testcase_05 AC 105 ms
56,004 KB
testcase_06 AC 102 ms
55,956 KB
testcase_07 AC 104 ms
55,952 KB
testcase_08 AC 102 ms
55,660 KB
testcase_09 AC 106 ms
55,664 KB
testcase_10 AC 102 ms
55,916 KB
testcase_11 AC 103 ms
55,872 KB
testcase_12 AC 104 ms
56,048 KB
testcase_13 AC 106 ms
55,456 KB
testcase_14 AC 104 ms
56,484 KB
testcase_15 AC 104 ms
55,696 KB
testcase_16 AC 104 ms
55,940 KB
testcase_17 AC 103 ms
56,280 KB
testcase_18 AC 105 ms
55,452 KB
testcase_19 AC 104 ms
55,724 KB
testcase_20 AC 106 ms
56,088 KB
testcase_21 AC 103 ms
55,724 KB
testcase_22 AC 104 ms
55,664 KB
testcase_23 AC 105 ms
56,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder604 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();

		if (c <= a) {
			pr.println(c);
		} else {
			long tmp = a - 1 + b;

			long tmp2 = c - c / tmp * tmp;
			if (tmp2 >= a) {
				pr.println(c / tmp * a + a);
			} else {
				pr.println(c / tmp * a + tmp2);
			}
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0