-
Notifications
You must be signed in to change notification settings - Fork 0
/
1311 - Unlucky Bird.cpp
100 lines (94 loc) · 4.78 KB
/
1311 - Unlucky Bird.cpp
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// Coded by Dhiman Sarker Bappi (Dhimanda) - RMSTU
//
// Today 17/11/2020 Bangladesh Standard Time 18:48:37 pm
// --------------------- Problem Info ---------------------
// Problem: 1311 - Unlucky Bird
// Contest: LightOJ
// URL: http://lightoj.com/volume_showproblem.php?problem=1311
// ----------------------------------------------------------
/// Coded by Dhiman Sarker Bappi (Dhimanda) - RMSTU
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define popb pop_back
#define pf push_front
#define popf pop_front
#define lcm(a,b) (a*b)/gcd(a,b)
#define gcd(a,b) __gcd(a,b)
#define pi 2*acos(0)
#define elif else if
#define ll long long
#define nl '\n'
#define endl '\n'
#define sp fixed << setprecision
#define all(x) x.begin(),x.end()
#define power(n,p) pow_mod(n, p, (1LL<<62))
#define yes printf("YES\n")
#define no printf("NO\n")
// ===================== DEBUG ==========================
#ifdef dhimanpc
template<typename T>void showSTL(T H);template<typename T,typename V>void showSTL(pair<T,V> H);
template<typename T>void showSTL(priority_queue<T> H);template<typename T>void showSTL(stack<T> H);
template<typename T,typename V>void showSTL(map<T,V> H);
template<typename T,typename V>void showSTL(multimap<T,V> H);template<typename T>void showSTL(vector<T> H);
template<typename T>void showSTL(set<T> H);template<typename T>void showSTL(multiset<T> H);
template<typename T>void showSTL(list<T> H);void showSTL(char *H);
template<typename T>void showSTL(deque<T> H);template<typename T>void showSTL(queue<T> H);
template<typename T>void showSTL(T H){stringstream ss;ss<<H;cerr<<ss.str();}
template<typename T,typename V>void showSTL(pair<T,V> H){cerr<<"(";showSTL(H.first);cerr<<"=>";showSTL(H.second);cerr<<")";}
template<typename T>void showSTL(priority_queue<T> H){cerr<<endl;while(!H.empty()){cerr<<H.top()<<endl;H.pop();}cerr<<endl;}
template<typename T>void showSTL(stack<T> H){cerr<<endl;while(!H.empty()){cerr<<H.top()<<endl;H.pop();}}
template<typename T,typename V>void showSTL(map<T,V> H){cerr<<"[ ";for(auto val:H){showSTL(val);cerr<<" ";}cerr<<"]";}
template<typename T,typename V>void showSTL(multimap<T,V> H){cerr<<"[ ";for(auto val:H){showSTL(val);cerr<<" ";}cerr<<"]";}
template<typename T>void showSTL(vector<T> H){cerr<<"[ ";for(auto val : H){showSTL(val);cerr<<' ';}cerr<<"]";}
template<typename T>void showSTL(set<T> H){cerr<<"[ ";for(auto val : H){showSTL(val);cerr<<' ';}cerr<<"]";}
template<typename T>void showSTL(multiset<T> H){cerr<<"[ ";for(auto val : H){showSTL(val);cerr<<' ';}cerr<<"]";}
template<typename T>void showSTL(list<T> H){cerr<<"[ ";for(auto val : H){showSTL(val);cerr<<' ';}cerr<<"]";}
void showSTL(char *H){for(int i=0;i<strlen(H);i++){showSTL(H[i]);};}
template<typename T>void showSTL(deque<T> H){cerr<<"[ ";for(auto val : H){showSTL(val);cerr<<' ';}cerr<<"]";}
template<typename T>void showSTL(queue<T> H){cerr<<"[ ";while(!H.empty()){showSTL(H.front());cerr<<' ';H.pop();}cerr<<"]";}
vector<string>vec_spltr(string s){s+=',';vector<string>res;while(!s.empty())
res.push_back(s.substr(0, s.find(','))),s=s.substr(s.find(',')+1);return res;}
void dbg_out(vector<string>__attribute__((unused))args,__attribute__((unused))int idx,__attribute__((unused))int LINE_NUM)
{cerr<<endl;}template<typename Head,typename... Tail>
void dbg_out ( vector <string> args, int idx, int LINE_NUM, Head H, Tail... T)
{if(idx>0)cerr<<", ";else cerr << "Line(" << LINE_NUM << "):";
cerr<<" "<<args[idx]<<" = ";showSTL(H);dbg_out(args,idx+1,LINE_NUM, T...);}
#define debug(...) dbg_out(vec_spltr(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#define in_file freopen("input.c", "r", stdin)
#define out_file freopen("output.c", "w", stdout)
#define fast 0
#else
#define debug(...) 0
#define in_file 0
#define out_file 0
#define fast ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#endif
// ===================== custom function ==========================
ll pow_mod(ll nn, ll pp, ll mm) { ll res = 1; while(pp > 0) { if(pp&1) res = (res * nn) % mm; pp = pp >> 1; nn = (nn * nn) % mm; } return res; }
void dhimanda();
// ===================== Main function ==========================
int main()
{
//fast;
int t=1;
scanf("%i" , &t);
for(int i=1 ; i<=t ; i++){
printf("Case %d: ", i);
dhimanda();
}
return 0;
}
void dhimanda(){
double v1,v2,v3,a1,a2;
cin >> v1 >> v2 >> v3 >> a1 >> a2;
double d = ((v1*v1)/(2*a1)) + ((v2*v2)/(2*a2)) ;
double t1 = (v1/a1) ;
double t2 = (v2/a2) ;
double time = max(t1,t2) ;
double ans = v3 * time ;
printf("%.9lf %.9lf\n", d, ans);
}
// Contact : chessdhiman@gmail.com