#include using namespace std; vector countPrimeTable(int N) { vector tables(N+1,0); tables[0] =0; tables[1] = 0; // N+1個の要素を持つベクトルを作成(初期値はtrue) vector isPrime(N + 1, true); isPrime[0] = isPrime[1] = false; // 0と1は素数ではない // エラトステネスの篩 for (int i = 2; i * i <= N; ++i) { if (isPrime[i]) { for (int j = i * i; j <= N; j += i) { isPrime[j] = false; } } } // 素数の個数をカウント int primeCount = 0; for (int i = 2; i <= N; ++i) { if (isPrime[i]) { ++primeCount; tables[i] = primeCount; } } return tables; } int main(){ vector Pi(100000+1,0); Pi= countPrimeTable(100001); int T; int N,P,Q; cin >> T; for(int i=0;i> N >> P >> Q; cout << (P*Pi[N])/(P*Pi[N]+(100-Q)*(N-Pi[N])) << endl; } }