Beating the Dataset LightOJ - 1274

You are in a contest, and unfortunately you don't have much time. You have one problem in hand; you just glanced at the sample output and found that it just wants 'YES' or 'NO'. So, you have made another plan instead of solving the problem as you know the system very well.

For this problem, every test case is stored in a separate file. When a submission is found, the system successively runs the solution on all tests of a problem, and for each test the checking process goes as follows. The input is copied to the file input.txt. Then the solution is launched. It reads the input from the file input.txt and writes the result to the file output.txt. When it finishes, the correct answer is copied to the file answer.txt. If the contents of the files answer.txt and output.txt match, the test is assumed to be passed; otherwise, the test is not passed.

So, you decided to write a program that would operate as follows. If the folder containing the program doesn't contain the file answer.txt (i.e. the program is run on the first test), then the program outputs "YES". Otherwise, the program outputs the contents of the file answer.txt. And before the contest, the sizes of the data files are given to you.

And it's clear that the size of the file with the answer "YES" is 3 bytes, the size of the file with the answer "NO" is 2 bytes, and all the variants of the order of tests are equally probable. Now you want to calculate the average number of tests that your solution won't pass.

Input

Input starts with an integer T (≤ 10), denoting the number of test cases.

Each case starts with a line containing two integers n (1 ≤ n ≤ 5000) and s (2n ≤ s ≤ 3n) where n denotes the number of data sets and s denotes the total size of the answer files.

Output

For each case, print the case number and the average number of tests your solution won't pass. Error less than 10-6 will be ignored.

Sample Input

4

3 7

1 2

1 3

4 10

Sample Output

Case 1: 2

Case 2: 1

Case 3: 0

Case 4: 2.5000000000

Note

For the first case, one of the three answers is "YES" and two answers are "NO". If the order of tests is "YES-NO-NO", then your solution won't pass the second test only; if the order is "NO-YES-NO", then it will pass none of the tests; if the order is "NO-NO-YES", the solution won't pass the first and the third tests.

#include<cstdio>
#include<cstring>
#include<algorithm>
 
using namespace std;
 
int n,m;
 
int main(){
    int i,j,cas;
    scanf("%d",&cas);
    for(int T=1;T<=cas;T++){
        scanf("%d%d",&n,&m);
        m = m-2*n;
        double ans = 1.0*(n-m)/n;
        if(n > 1)ans += 2.0*(n-1.0)*m*(n-m)/n/(n-1.0);
 
        printf("Case %d: %.8f\n",T,ans);
    }
    return 0;
}

 

### 回答1: 以下是C++表白代码,其中包含了一个跳动的心脏图案: ``` #include <iostream> #include <windows.h> using namespace std; int main() { cout << "我喜欢你,愿意做你的男朋友吗?" << endl; Sleep(300); //等待3秒 //打印跳动的心脏图案 for (int i = ; i < 20; i++) { cout << " ** ** " << endl; cout << " ** ** " << endl; cout << " ** ** " << endl; cout << "** **" << endl; cout << "** **" << endl; cout << " ** ** " << endl; cout << " ** ** " << endl; cout << " ** ** " << endl; Sleep(200); //等待.2秒 system("cls"); //清屏 Sleep(200); //等待.2秒 } return ; } ``` 希望这个代码能够帮助你成功表白! ### 回答2: “C表白代码”是一种特殊的编程方式,就是写代码来表达自己对他人的情感表白。其中,“beating heart”就是其中一种表白代码,也是比较受欢迎的一种。 “beating heart”的代码格式是一个无限循环的心形图案,里面不断闪现的“炫酷数字”。具体来说,代码会通过调用一些函数来实现循环和闪烁的效果,让心形图案跳动起来,表示出心中不断跳动的爱意。 使用“beating heart”表白代码,能够让人感受到浪漫与幸福。因为心形图案和跳动的数字,都让人想起爱情中那份充满活力、热情与温暖的感觉。同时,通过编写代码的方式来表达爱情,也能体现出程序员们一丝不苟、敬业认真的工作态度和技术水平。 当然,使用表白代码也有一些需要注意的事项。首先,要考虑受方是否能够理解和接受这种方式表达的情感,毕竟不是所有人都懂得编程。其次,要避免使用机密信息或者涉及隐私的内容。最后,千万不要将自己的感情完全依赖于代码,真正的爱情需要口头表达和行动相结合。 总而言之,“beating heart”是一种很有意义的编程方式,可以通过代码来表达爱情的感觉,不论技术水平如何,这种方式都具有一定的吸引力和浪漫情趣。 ### 回答3: “beating heart”,也就是“跳动的心”,是表白代码中非常经典的一种。它通常表示的是对某个人深深的爱意,让人感觉到自己的内心在跳动。 这种表白代码以“<3”符号为主体,再加上一些特殊的字符,形成一个类似于心脏跳动的图案。这种表白方式可以在聊天软件、社交网站、短信等各种场合使用,非常适合用来表达爱意。 “beating heart”表白代码的使用,通常应该具备以下几个条件: 1. 表白对象必须是你深深爱着的人,而不是随便一个人; 2. 表白代码可以作为爱意的附加表达方式,但不应该取代其他更真挚的表白方式,例如直接用文字或口头表达爱意; 3. 当使用这种表白方式时,应该考虑到对方的接受程度,如果对方对表白代码不太了解,或者根本没有耐心去理解这个代码所代表的意思,那么在表达爱意时就会失去效果。 在使用“beating heart”的时候,需要注意一些细节,比如: 1. 需要确保符号和字符的显示效果,一些软件或网站可能不支持某些字符而显示错误; 2. 在表白时需要选择合适的场合,例如在对方浪漫情绪高涨或者对你有好感的时候; 3. 正确选择表白对象,确保自己的感情和目的都是纯粹的,而不是为了恶意或者利益而表白; 总之,“beating heart”表白代码是一种非常文艺和浪漫的表白方式,可以用来表达自己对某个人的真挚爱意,但需要合适的场合和对象。最重要的是,无论使用哪种表白方式,真诚和纯粹的爱意才是最重要的。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值