编程介的小学生 2019-04-17 17:23 采纳率: 20.5%
浏览 173

分数和分数的平方的等式问题利用C语言的办法如何求解,具体一个问题的代码的实现

Problem Description
You are now working in a physical laboratory. One day, when you were skimming through your records of experiments, you find that the squared frequency, defined as (P/Q)2, in which Q indicates times of experiments and P means number of experiments in which the expected phenomenon appears, is somehow unreasonable. The squared frequency F (0 < F < 1) is written in decimal form, and rounded to K (K ≤ 9) numbers after the decimal point. You think that Q, i.e. times of experiments, is too small to obtain such a number. Now you need to work out a fraction P/Q, so that rounding (P/Q)2 to K numbers after the decimal point gets exactly F, and minimizes Q.

Input
Input contains no more than 2000 test cases.

Each test case has a single line, which contains a decimal fraction indicating F, the squared frequency.

Output
For each test case, output your answer in a line with the case number, follow the format in sample. You should print a blank after ':'.

If the answer is not unique, output the one with the minimum P.

Sample Input
0.3
0.5
0.50

Sample Output
Case #1: 1/2
Case #2: 5/7
Case #3: 12/17

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 数学的三元一次方程求解
    • ¥20 iqoo11 如何下载安装工程模式
    • ¥15 本题的答案是不是有问题
    • ¥15 关于#r语言#的问题:(svydesign)为什么在一个大的数据集中抽取了一个小数据集
    • ¥15 C++使用Gunplot
    • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
    • ¥15 matlab数字图像处理频率域滤波
    • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
    • ¥15 ELGamal和paillier计算效率谁快?
    • ¥15 蓝桥杯单片机第十三届第一场,整点继电器吸合,5s后断开出现了问题