-
Notifications
You must be signed in to change notification settings - Fork 0
/
DIWALI1.cpp
65 lines (56 loc) · 1.97 KB
/
DIWALI1.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
// Problem: Maximum Light Up
// Contest: CodeChef - CodeChef Starters 13 Division 2 (Rated)
// URL: https://www.codechef.com/START13B/problems/DIWALI1
// Memory Limit: 256 MB
// Time Limit: 1000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#pragma GCC diagnostic ignored "-Wformat"
#pragma GCC diagnostic ignored "-Wsign-compare"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std ;
#define Pi 2*acos(0.0)
#define ll long long
#define pb push_back
#define mp make_pair
#define MAX 500006
#define MAX1 10000008
#define mem(a,v) memset(a,v,sizeof(a))
#define lcm(a, b) ((a)*((b)/__gcd(a,b)))
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
void fastIO (){ios_base::sync_with_stdio(false);cin.tie(0); cout.precision(20);}
template<class T> using oset=tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
// order_of_key returns the 0 based position of a value
// find_by_order returns a pointer pointing at the kth element
// also 0 indexed
ll A[MAX];
ll B[MAX];
ll C[MAX];
int main ()
{
fastIO();
ll a, b, c, d, n, m, k, l, p, q, r, t, x, y;
ll cnt = 0, cntr = 0, sum = 0,ans = 1, check = 0;
ll Max = 0, Min = 2e18;
string s, s1, s2;
cin >> t;
while(t--){
cin >> p >> a >> b >> c >> x >> y;
m = x * a + b;
n = y * a + c;
cout << max(p/ m, p/ n)<<endl;
}
/*
always check the limit and make sure that is correct.
lcm of first 40 numbers can be calculated.
sqrt of 10^9 is 31622.
always usee 1LL while doing binary operations.
*/
return (0 - 0 + 1 - 1 * 1);
}