結果

問題 No.604 誕生日のお小遣い
ユーザー 夕叢霧香(ゆうむらきりか)夕叢霧香(ゆうむらきりか)
提出日時 2017-12-04 00:11:16
言語 Java21
(openjdk 21)
結果
AC  
実行時間 56 ms / 1,000 ms
コード長 1,628 bytes
コンパイル時間 2,151 ms
コンパイル使用メモリ 77,524 KB
実行使用メモリ 50,520 KB
最終ジャッジ日時 2024-05-01 14:23:10
合計ジャッジ時間 4,180 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
50,400 KB
testcase_01 AC 53 ms
50,452 KB
testcase_02 AC 53 ms
50,128 KB
testcase_03 AC 53 ms
50,076 KB
testcase_04 AC 54 ms
50,464 KB
testcase_05 AC 54 ms
50,164 KB
testcase_06 AC 54 ms
50,376 KB
testcase_07 AC 54 ms
50,416 KB
testcase_08 AC 53 ms
50,268 KB
testcase_09 AC 55 ms
50,452 KB
testcase_10 AC 54 ms
50,448 KB
testcase_11 AC 54 ms
50,080 KB
testcase_12 AC 54 ms
50,068 KB
testcase_13 AC 55 ms
50,128 KB
testcase_14 AC 56 ms
50,016 KB
testcase_15 AC 54 ms
50,384 KB
testcase_16 AC 54 ms
50,384 KB
testcase_17 AC 54 ms
50,176 KB
testcase_18 AC 54 ms
50,288 KB
testcase_19 AC 53 ms
50,520 KB
testcase_20 AC 53 ms
50,092 KB
testcase_21 AC 53 ms
50,336 KB
testcase_22 AC 54 ms
50,480 KB
testcase_23 AC 54 ms
49,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        long a=sc.nextLong();
        long b=sc.nextLong();
        long c=sc.nextLong();
        long r=c%(a+b-1);
        out.println(c/(a+b-1)*a+(r>=a?a:r));
        out.close();
    }
    // http://codeforces.com/blog/entry/7018
    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;
    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;
        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}
0