From 377a457211f24491c01d07d440da8cf0741ac17d Mon Sep 17 00:00:00 2001 From: ShazidMahsrafi Date: Wed, 28 Feb 2024 18:12:30 +0600 Subject: [PATCH] added 1933 --- .../1933A.cpp | 67 +++++++++++++++++ .../1933B.cpp | 75 +++++++++++++++++++ .../1933C.cpp | 71 ++++++++++++++++++ Readme.md | 3 + 4 files changed, 216 insertions(+) create mode 100644 Codes/1933 A - Turtle Puzzle Rearrange and Negate/1933A.cpp create mode 100644 Codes/1933 B - Turtle Math Fast Three Task/1933B.cpp create mode 100644 Codes/1933 C - Turtle Fingers Count the Values of k/1933C.cpp diff --git a/Codes/1933 A - Turtle Puzzle Rearrange and Negate/1933A.cpp b/Codes/1933 A - Turtle Puzzle Rearrange and Negate/1933A.cpp new file mode 100644 index 0000000..21d7fcf --- /dev/null +++ b/Codes/1933 A - Turtle Puzzle Rearrange and Negate/1933A.cpp @@ -0,0 +1,67 @@ +#include +using namespace std; + +#define FAST_IO (ios_base:: sync_with_stdio(false),cin.tie(NULL)); +#define ll long long +#define ull unsigned long long +#define endl '\n' +#define ff first +#define ss second +#define pb push_back +#define all(x) x.begin(), x.end() +#define sz(x) (int)(x).size() +#define yes cout<<"YES"<>= 1; } return ans; } +bool isPrime(ll n) { if(n <= 1) return false; for(ll i = 2; i*i <= n; i++) if(n % i == 0) return false; return true; } + +#ifndef ONLINE_JUDGE +#define dbg(x...) cerr << #x << " : "; _print(x) +#else +#define dbg(...) +#endif +void __print(int x) {cerr << x;}void __print(long x) {cerr << x;} void __print(long long x){cerr << x;} +void __print(unsigned x){cerr << x;} void __print(unsigned long x){cerr << x;} void __print(unsigned long long x){cerr << x;} +void __print(float x){cerr << x;} void __print(double x){cerr << x;} void __print(long double x){cerr << x;} +void __print(char x){cerr << x;} void __print(const char *x){cerr << x;} void __print(const string &x){cerr << x;} +void __print(bool x){cerr << (x ? "true" : "false");} void _print() { cerr << "\n"; } +template void __print(const A &x); template void __print(const pair &p); +template void __print(const A &x) {bool f=1; cerr << '['; for (const auto &i : x) {cerr << (f ? "" : ","), __print(i); f = 0;} cerr << ']';} +template void __print(const pair &p) {cerr << '('; __print(p.first); cerr << ','; __print(p.second); cerr << ')';} +template void _print(const Head &H, const Tail &...T) { __print(H); if (sizeof...(T)) cerr << ", "; _print(T...);} +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void solve() +{ + int n,sum=0; + cin>>n; + for(int i=0; i>x; + sum += abs(x); + } + cout<> TC; + while (TC--) + solve(); +} \ No newline at end of file diff --git a/Codes/1933 B - Turtle Math Fast Three Task/1933B.cpp b/Codes/1933 B - Turtle Math Fast Three Task/1933B.cpp new file mode 100644 index 0000000..b153566 --- /dev/null +++ b/Codes/1933 B - Turtle Math Fast Three Task/1933B.cpp @@ -0,0 +1,75 @@ +#include +using namespace std; + +#define FAST_IO (ios_base:: sync_with_stdio(false),cin.tie(NULL)); +#define ll long long +#define ull unsigned long long +#define endl '\n' +#define ff first +#define ss second +#define pb push_back +#define all(x) x.begin(), x.end() +#define sz(x) (int)(x).size() +#define yes cout<<"YES"<>= 1; } return ans; } +bool isPrime(ll n) { if(n <= 1) return false; for(ll i = 2; i*i <= n; i++) if(n % i == 0) return false; return true; } + +#ifndef ONLINE_JUDGE +#define dbg(x...) cerr << #x << " : "; _print(x) +#else +#define dbg(...) +#endif +void __print(int x) {cerr << x;}void __print(long x) {cerr << x;} void __print(long long x){cerr << x;} +void __print(unsigned x){cerr << x;} void __print(unsigned long x){cerr << x;} void __print(unsigned long long x){cerr << x;} +void __print(float x){cerr << x;} void __print(double x){cerr << x;} void __print(long double x){cerr << x;} +void __print(char x){cerr << x;} void __print(const char *x){cerr << x;} void __print(const string &x){cerr << x;} +void __print(bool x){cerr << (x ? "true" : "false");} void _print() { cerr << "\n"; } +template void __print(const A &x); template void __print(const pair &p); +template void __print(const A &x) {bool f=1; cerr << '['; for (const auto &i : x) {cerr << (f ? "" : ","), __print(i); f = 0;} cerr << ']';} +template void __print(const pair &p) {cerr << '('; __print(p.first); cerr << ','; __print(p.second); cerr << ')';} +template void _print(const Head &H, const Tail &...T) { __print(H); if (sizeof...(T)) cerr << ", "; _print(T...);} +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void solve() +{ + int n,sum=0,flag=0; + cin>>n; + for(int i=0; i>x; + if(x%3==1) + flag=1; + sum +=x; + } + dbg(sum); + if(sum%3==0) + cout<<0<> TC; + while (TC--) + solve(); +} \ No newline at end of file diff --git a/Codes/1933 C - Turtle Fingers Count the Values of k/1933C.cpp b/Codes/1933 C - Turtle Fingers Count the Values of k/1933C.cpp new file mode 100644 index 0000000..f40c667 --- /dev/null +++ b/Codes/1933 C - Turtle Fingers Count the Values of k/1933C.cpp @@ -0,0 +1,71 @@ +#include +using namespace std; + +#define FAST_IO (ios_base:: sync_with_stdio(false),cin.tie(NULL)); +#define ll long long +#define ull unsigned long long +#define endl '\n' +#define ff first +#define ss second +#define pb push_back +#define all(x) x.begin(), x.end() +#define sz(x) (int)(x).size() +#define yes cout<<"YES"<>= 1; } return ans; } +bool isPrime(ll n) { if(n <= 1) return false; for(ll i = 2; i*i <= n; i++) if(n % i == 0) return false; return true; } + +#ifndef ONLINE_JUDGE +#define dbg(x...) cerr << #x << " : "; _print(x) +#else +#define dbg(...) +#endif +void __print(int x) {cerr << x;}void __print(long x) {cerr << x;} void __print(long long x){cerr << x;} +void __print(unsigned x){cerr << x;} void __print(unsigned long x){cerr << x;} void __print(unsigned long long x){cerr << x;} +void __print(float x){cerr << x;} void __print(double x){cerr << x;} void __print(long double x){cerr << x;} +void __print(char x){cerr << x;} void __print(const char *x){cerr << x;} void __print(const string &x){cerr << x;} +void __print(bool x){cerr << (x ? "true" : "false");} void _print() { cerr << "\n"; } +template void __print(const A &x); template void __print(const pair &p); +template void __print(const A &x) {bool f=1; cerr << '['; for (const auto &i : x) {cerr << (f ? "" : ","), __print(i); f = 0;} cerr << ']';} +template void __print(const pair &p) {cerr << '('; __print(p.first); cerr << ','; __print(p.second); cerr << ')';} +template void _print(const Head &H, const Tail &...T) { __print(H); if (sizeof...(T)) cerr << ", "; _print(T...);} +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void solve() +{ + ll a,b,l; + cin>>a>>b>>l; + setst; + for(ll x=0; mypow(a,x)<=l; ++x) + { + for(ll y=0; mypow(b,y)<=l;++y) + { + ll res=mypow(a,x)*mypow(b,y); + if(l%res==0) + st.insert(l/res); + } + } + cout<> TC; + while (TC--) + solve(); +} \ No newline at end of file diff --git a/Readme.md b/Readme.md index a90df01..1484977 100644 --- a/Readme.md +++ b/Readme.md @@ -286,6 +286,9 @@ This repository contains my solutions of Codeforces problems. They are in C++ la | 274 | 1931 A | Recovering a Small String | [Question](https://codeforces.com/problemset/problem/1931/A) | [Solution](https://github.com/ShazidMashrafi/Codeforces-Solutions/tree/master/Codes/1931%20A%20-%20Recovering%20a%20Small%20String) | 275 | 1931 B | Make Equal | [Question](https://codeforces.com/problemset/problem/1931/B) | [Solution](https://github.com/ShazidMashrafi/Codeforces-Solutions/tree/master/Codes/1931%20B%20-%20Make%20Equal) | 276 | 1931 C | Make Equal Again | [Question](https://codeforces.com/problemset/problem/1931/C) | [Solution](https://github.com/ShazidMashrafi/Codeforces-Solutions/tree/master/Codes/1931%20C%20-%20Make%20Equal%20Again) +| 277 | 1933 A | Turtle Puzzle Rearrange and Negate | [Question](https://codeforces.com/problemset/problem/1933/A) | [Solution](https://github.com/ShazidMashrafi/Codeforces-Solutions/tree/master/Codes/1933%20A%20-%20Turtle%20Puzzle%20Rearrange%20and%20Negate) +| 278 | 1933 B | Turtle Math Fast Three Task | [Question](https://codeforces.com/problemset/problem/1933/B) | [Solution](https://github.com/ShazidMashrafi/Codeforces-Solutions/tree/master/Codes/1933%20B%20-%20Turtle%20Math%20Fast%20Three%20Task) +| 279 | 1933 C | Turtle Fingers Count the Values of k | [Question](https://codeforces.com/problemset/problem/1933/C) | [Solution](https://github.com/ShazidMashrafi/Codeforces-Solutions/tree/master/Codes/1933%20C%20-%20Turtle%20Fingers%20Count%20the%20Values%20of%20k)