結果

問題 No.604 誕生日のお小遣い
ユーザー 夕叢霧香(ゆうむらきりか)夕叢霧香(ゆうむらきりか)
提出日時 2017-12-04 00:11:16
言語 Java21
(openjdk 21)
結果
AC  
実行時間 43 ms / 1,000 ms
コード長 1,628 bytes
コンパイル時間 1,992 ms
コンパイル使用メモリ 74,116 KB
実行使用メモリ 49,988 KB
最終ジャッジ日時 2023-08-14 01:21:26
合計ジャッジ時間 4,029 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
49,384 KB
testcase_01 AC 38 ms
49,508 KB
testcase_02 AC 38 ms
49,816 KB
testcase_03 AC 38 ms
49,356 KB
testcase_04 AC 39 ms
49,988 KB
testcase_05 AC 40 ms
47,376 KB
testcase_06 AC 43 ms
49,380 KB
testcase_07 AC 42 ms
49,348 KB
testcase_08 AC 40 ms
49,804 KB
testcase_09 AC 39 ms
49,592 KB
testcase_10 AC 41 ms
49,260 KB
testcase_11 AC 38 ms
49,544 KB
testcase_12 AC 39 ms
49,692 KB
testcase_13 AC 39 ms
49,308 KB
testcase_14 AC 38 ms
49,248 KB
testcase_15 AC 40 ms
49,456 KB
testcase_16 AC 39 ms
49,536 KB
testcase_17 AC 38 ms
49,704 KB
testcase_18 AC 39 ms
49,276 KB
testcase_19 AC 39 ms
49,340 KB
testcase_20 AC 39 ms
49,380 KB
testcase_21 AC 40 ms
49,252 KB
testcase_22 AC 38 ms
49,368 KB
testcase_23 AC 38 ms
49,296 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