Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions Problem Statement-1/Solution/Partha_gameofcodes_Ps-1cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#include<bits/stdc++.h>

using namespace std;

#define ll long long int

const ll mod = 1e9+7;

void solve(){



ll n,k,a,b;



cin>>n>>a>>b>>k;



ll g=__gcd(a,b);



ll lcm=(a*b)/g;



ll tab=n/lcm;



ll ta=(n/a)-tab;



ll tb=(n/b)-tab;







if((ta+tb)>=k)

{

cout<<"Win"<<endl;

}

else

{

cout<<"Lose"<<endl;

}



}

int main()

{

ios_base::sync_with_stdio(0);

cin.tie(0);

cout.tie(0);





int t=1;

cin>>t;



while(t--) solve();



return 0;

}

99 changes: 99 additions & 0 deletions Problem Statement-2/Solution/Partha_gameofcodes_Ps-2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#include<bits/stdc++.h>

using namespace std;

#define ll long long int

const ll mod = 1e9+7;

bool palindrome (string s,int r){

int i = 0, j = r-1;



while(i<j){

if(s[i]!=s[j]) return false;

i++;

j--;

}



return true;



}

int depth(string s,int r){



if(r%2==1) return 0;



if(palindrome (s,r)){



return 1 + depth(s,r/2);



}



return 0;

}

void solve(){



ll n; cin>>n;



string s; cin>>s;



cout<<depth(s,n);

}

int main()

{

ios_base::sync_with_stdio(0);

cin.tie(0);

cout.tie(0);





int t=1;

//cin>>t;



while(t--) solve();



return 0;

}
169 changes: 169 additions & 0 deletions Problem Statement-3/Solution/Partha_gameofcodes_Ps-3.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
#include<bits/stdc++.h>

using namespace std;

#define ll long long int

const ll mod = 1e9+7;

vector<ll > v;

void seive(ll n)

{

bool prime[n+1]; memset(prime, true, sizeof(prime));

for (ll p=2; p*p<=n; p++)

{

if (prime[p] == true)

{

for (ll i=p*p; i<=n; i += p)

prime[i] = false;

}

}





for (ll p=2; p<=n; p++){

if (prime[p]) {

v.push_back(p);

}

}

}

void solve(){



ll m,x,j,i,y;



i=5;

x=5;

j=2;

y=7;



cin>>m;



vector<ll > arr;

arr.push_back(66);

arr.push_back(55);





while(j<m)

{

if(i%2!=0)

{

arr.push_back(v[i]*x);j+=2;

arr.push_back(v[i]*y);

}

else if(i%2==0)

{

arr.push_back(v[i]*y);

arr.push_back(v[i]*x); j+=2;

}

i++;

}





if(m%2)

{



arr.pop_back();



}



arr.back()*=2;



for(auto i:arr)

cout<<i<<" ";



cout<<endl;

}

int main()

{

ios_base::sync_with_stdio(0);

cin.tie(0);

cout.tie(0);



seive(1000000);



int t=1;

cin>>t;



while(t--) solve();



return 0;

}