Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define boAshraf ios_base::sync_with_stdio(false); cin.tie(NULL);
- #define ll long long
- #define sz(s) (int)(s).size()
- #define all(s) (s).begin(),(s).end()
- using namespace std;
- void File();
- void sol();
- const long double pi = acos(-1);
- int main() {
- boAshraf
- File();
- int t = 1;
- cin >> t;
- while (t--) {
- sol();
- }
- return 0;
- }
- void sol() {
- ll n,m,R;
- cin>>n>>m>>R;
- auto valid=[&](ll mid)->bool{
- long double tot=mid*2*pi*R+(mid)*(mid-1)*pi*m;
- return tot>=n;
- };
- ll l=1,r=1e9,ans=-1;
- while(l<=r){
- ll mid=(l+r)/2;
- if(valid(mid))ans=mid,r=mid-1;
- else l=mid+1;
- }
- cout<<R+(ans-1)*m<<'\n';
- }
- void File() {
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- }
Advertisement
Add Comment
Please, Sign In to add comment