Last active
September 8, 2015 13:35
-
-
Save markroxor/90c223abdc010daedca5 to your computer and use it in GitHub Desktop.
Correct - BANROB (LONG SEPT CF)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
using namespace std; | |
main() | |
{ | |
#ifndef ONLINE_JUDGE | |
freopen("input.txt", "r", stdin); | |
//freopen("output.txt","w",stdout); | |
#endif | |
ios::sync_with_stdio(0); | |
long long t; | |
cin >> t; | |
cout << fixed << setprecision(6); | |
while(t--) | |
{ | |
long long m; | |
long double mon = 1000000000; | |
long double p; | |
cin >> m >> p; | |
long double fir; | |
if(m%2==1){ | |
fir=mon*(1+pow(p,m));} | |
else | |
fir=mon*(1-pow(p,m)); | |
fir/=(1+p); | |
cout << fir << ' ' << mon-fir << '\n'; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment