From d2b9ab14739514111393a5174a910783c20f9415 Mon Sep 17 00:00:00 2001 From: ADITYA SINGH Date: Sun, 27 Feb 2022 16:29:57 +0530 Subject: [PATCH 1/2] Added Solution for Problem - 1 --- Aditya Singh_gameofcodes_ps1.cpp | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Aditya Singh_gameofcodes_ps1.cpp 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; + +} From d34846f4f040f625ee2ae8fc9029a25d9b0b0679 Mon Sep 17 00:00:00 2001 From: ADITYA SINGH Date: Sun, 27 Feb 2022 17:46:55 +0530 Subject: [PATCH 2/2] Aditya Singh_gameofcode_ps-2 Name - Aditya Singh e - Mail - adityasingh10042@gmail.com --- Aditya Singh_gameofcodes_ps2.cpp | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Aditya Singh_gameofcodes_ps2.cpp 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; +}