light oj 1274 - Beating the Dataset

#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <ctime>
#include <queue>
#include <cmath>
#include <bitset>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
const int maxn = 5002;
const int SIZE = 511111;
const double eps = 1e-10;
int main() {
	int n, s, a, b;
	int T, cas;
	scanf("%d", &T);
	for (cas = 1; cas <= T; ++cas) {
		scanf("%d%d", &n, &s);
		a = s - n * 2, b = n - a;
		double ans = (2.0 * a * b + b) / (a + b);
		printf("Case %d: %.10f\n", cas, ans);
	}
	return 0;
}

發佈了102 篇原創文章 · 獲贊 4 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章