编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#46523 #1007. G. 兼济天下 Accepted 100 208 ms 15836 K Java / 884 B RuoWu 2020-09-27 17:22:36
显示原始代码
import java.util.Scanner;

public class OJ_1007 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        double[] ans = new double[n];
        for (int i = 0; i < n; i++) {
            int person = in.nextInt() - 1;
            int cost = in.nextInt();
            if (cost % person == 0) {
                ans[i] = 0;
            } else {
                ans[i] = (cost / person + 1) * (person - 1) + (double) cost / person - cost;
                ans[i] = (cost / person + 1 - (double) cost / person) * (person - 1);
            }
        }
        for (int i = 0; i < n; i++) {
            if (ans[i] == 0) {
                System.out.println("CSFNB!");
            } else {
                System.out.printf("%.6f%n", ans[i]);
            }
        }
        in.close();
    }
}
子任务 #1
Accepted
得分:100
测试点 #1
Accepted
得分:100
用时:208 ms
内存:15836 KiB

输入文件(1.in

10
3 17
4 21
2 0
2 1000000000
1000000000 999999999
1000000000 1000000000
1000000000 999999998
154236
<37 bytes omitted>

答案文件(1.ans

0.500000
CSFNB!
CSFNB!
CSFNB!
CSFNB!
999999997.000000
1.000000
9737972.368635
158.314655
99
<16 bytes omitted>

用户输出

0.500000
CSFNB!
CSFNB!
CSFNB!
CSFNB!
999999997.000000
1.000000
9737972.368635
158.314655
999999997.000000

系统信息

Exited with return code 0