diff --git a/Aditya Singh_gameofcodes_ps1.cpp b/Aditya Singh_gameofcodes_ps1.cpp new file mode 100644 index 0000000..87bed2a --- /dev/null +++ b/Aditya Singh_gameofcodes_ps1.cpp @@ -0,0 +1,48 @@ +#include +using namespace std; +#define nl "\n" +#define ll long long +#define ull unsigned long long +#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); +const ull mod = 1e9+7; + +int main(){ + + fast; + int t; + cin >> t; + while(t--) + { + int n,a,b,k; + cin >> n >> a >> b >> k; + int avni = 0; + int anuj = 0; + for(int i=0; i> extra; + if(extra%a==0 && extra%b!=0) + { + avni++; + } + else if(extra%a!=0 and extra%b==0) + { + anuj++; + } + } + + int total = avni+anuj; + if(total >= k) + { + cout << "Win" << nl; + } + else + { + cout << "Lose" << nl; + } + + cout << nl; + } + return 0; + +} diff --git a/Aditya Singh_gameofcodes_ps2.cpp b/Aditya Singh_gameofcodes_ps2.cpp new file mode 100644 index 0000000..609a2a9 --- /dev/null +++ b/Aditya Singh_gameofcodes_ps2.cpp @@ -0,0 +1,49 @@ + +#include +using namespace std; +#define nl "\n" +#define ll long long +#define ull unsigned long long +#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); +const ull mod = 1e9+7; + +int gcd(int a, int b) +{ + if (a == 0 || b == 0) + return 0; + + // base case + if (a == b) + return a; + + // a is greater + if (a > b) + return gcd(a - b, b); + return gcd(a, b - a); +} + +int cpFact(int x, int y) +{ + while (gcd(x, y) != 1) { + x = x / gcd(x, y); + } + return x; +} + + +int main() +{ + fast; + int t; + cin >> t; + while(t--) + { + int x, y; + cin >> x >> y; + cout << cpFact(x, y) << nl; + + } + + cout << nl; + return 0; +}