結果

問題 No.928 軽減税率?
ユーザー 37zigen37zigen
提出日時 2019-11-22 22:52:22
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,358 bytes
コンパイル時間 3,403 ms
コンパイル使用メモリ 77,700 KB
実行使用メモリ 54,360 KB
最終ジャッジ日時 2024-04-19 12:15:24
合計ジャッジ時間 6,938 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
52,852 KB
testcase_01 AC 115 ms
53,876 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 108 ms
54,080 KB
testcase_05 AC 110 ms
54,124 KB
testcase_06 AC 110 ms
54,120 KB
testcase_07 AC 112 ms
54,148 KB
testcase_08 AC 102 ms
52,980 KB
testcase_09 AC 113 ms
54,284 KB
testcase_10 AC 117 ms
54,072 KB
testcase_11 AC 105 ms
53,684 KB
testcase_12 AC 119 ms
54,096 KB
testcase_13 AC 117 ms
54,156 KB
testcase_14 AC 111 ms
53,996 KB
testcase_15 AC 112 ms
52,808 KB
testcase_16 AC 102 ms
52,988 KB
testcase_17 AC 104 ms
53,084 KB
testcase_18 AC 120 ms
54,132 KB
testcase_19 AC 109 ms
53,732 KB
testcase_20 AC 115 ms
52,640 KB
testcase_21 AC 109 ms
53,744 KB
testcase_22 AC 110 ms
52,580 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 102 ms
53,020 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class Main
{
    public static void main(String[] args)
    {
        new Main().run();
    }
    
    long MAX = (long) 1e3;
    
    void run() {
        Scanner sc = new Scanner(System.in);
        long P = sc.nextLong();
        long Q = sc.nextLong();
        long A = sc.nextLong();
        System.out.println(solve(P, Q, A));
    }
    
    long exact(long P, long Q, long A) {
        long ans = 0;
        for (long x = 1; x <= MAX; ++x) {
            if ((P + 100) * x / 100  < (Q + 100) * x / 100 + A ) ++ans;
        }
        return ans;
    }
    
    long solve(long P, long Q, long A) {
        if (P == Q) {
            if (A == 0) return 0;
            else return MAX;
        }
        if (P < Q) {
            long v = Math.max(1, 100 * ( 1 - A) / (Q - P) + 1);
            long ans = MAX - v;
            for (long x = 1; x <= v; ++x) 
                if ((P + 100) * x / 100  < (Q + 100) * x / 100 + A ) ++ans;
            return ans;
        }
        if (A == 0) {
            return 0;
        }
        
        long ans = Math.max(0, (A - 1) * 100 / (P - Q) - 1);
        for (long x = Math.max(1, (A - 1) * 100 / (P - Q)); x <= (A + 1) * 100 / (P - Q); ++x) {
            if ((P + 100) * x / 100  < (Q + 100) * x / 100 + A ) ++ans;
        }
        return ans;
    }
}
0