-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathFAMWEALT.cpp
More file actions
35 lines (35 loc) · 1.02 KB
/
FAMWEALT.cpp
File metadata and controls
35 lines (35 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include<iostream>
#include<cstdio>
#include <cmath>
#include <map>
using namespace std;
int main(){
map< int, pair<long long int, int> >a;
map< int, pair<long long int, int> >::iterator it, it1;
a.clear();
a.insert(make_pair(1, make_pair(1, 0)));
int q;
for(int i = 1; i < 500005; i++){
it = a.find(i);
if(it->second.second == 0){
a.insert(make_pair(2 * i, make_pair((it->second.first) * 2, 1)));
a.insert(make_pair(2 * i + 1, make_pair((it->second.first) * 4, 0)));
}
else{
a.insert(make_pair(2 * i, make_pair((it->second.first) * 2, 1)));
a.insert(make_pair(2 * i + 1, make_pair((it->second.first) * 2, 0)));
}
}
int t,i,x,y,w;
scanf("%d",&t);
double ans;
while(t--){
scanf("%d",&x);
scanf("%d",&y);
scanf("%d",&w);
it = a.find(x);
it1= a.find(y);
ans = (double)w * (it->second.first)/ (double)it1->second.first;
printf("%.6lf\n",ans);
}
}