#include #include #include #include const int MAX{100010}; bool siv[MAX]; int cnt[MAX + 1]; int main() { std::cin.tie(nullptr)->sync_with_stdio(false); std::fill(siv, siv + MAX, true); siv[0] = siv[1] = false; for (int i{2} ; i * i < MAX ; i++) if (siv[i]) { for (int j{i * i} ; j < MAX ; j += i) siv[j] = false; } for (int i{} ; i < MAX ; i++) cnt[i + 1] = cnt[i] + (siv[i] == true); int T; std::cin >> T; std::cout << std::fixed << std::setprecision(8); while (T--) { int N, P, Q; std::cin >> N >> P >> Q; // 素数を選んで、Yes long double a{1}; a *= (long double)cnt[N + 1] / (long double)N; a *= (long double)P / 100.0l; // 合成数を選んで、Yes long double b{1}; b *= (long double)(N - cnt[N + 1]) / (long double)N; b *= (long double)(100 - Q) / 100.0l; std::cout << a / (a + b) << '\n'; } }