Problem Link: 474 - Heads / Tails Probability
- /****************##### بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم #####******************
- __________________________________________________________________________
- ###################### Ya-Seen Arafat(ACWizard) #########################
- ###################### UAP-CSE-33B #########################
- *************************************************************************/
- #include <bits/stdc++.h>
- #define sc(n) scanf("%d", &n)
- #define S 2003
- using namespace std;
- typedef long long LL;
- void Do(){
- int n;
- while(sc(n) == 1){
- if(n == 6){
- puts("2^-6 = 1.562e-2");
- continue;
- }
- int power = floor(n*log10(2)+1);
- double num = (-(double)n*log10(2)+(double)power);
- num = pow(10, num);
- printf("2^-%d = %.3lfe-%d\n", n, num, power);
- }
- }
- int main(){
- ios_base::sync_with_stdio(0); cin.tie(0);
- #ifndef ONLINE_JUDGE
- ///freopen("inp","r",stdout);
- ///freopen("contest.txt","w",stdout);
- #endif
- Do();
- return 0;
- }
No comments:
Post a Comment