結果

問題 No.604 誕生日のお小遣い
ユーザー tenten
提出日時 2020-09-05 23:45:39
言語 Java
(openjdk 23)
結果
AC  
実行時間 143 ms / 1,000 ms
コード長 435 bytes
コンパイル時間 2,355 ms
コンパイル使用メモリ 73,852 KB
実行使用メモリ 41,580 KB
最終ジャッジ日時 2024-11-29 06:21:19
合計ジャッジ時間 6,642 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

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