feat: Add solutions for Codeforces problems 1968A and 1968B
This commit is contained in:
parent
cfcd860bf0
commit
f86ca97ed3
34
Codes/1968 A - Maximize/1968A.cpp
Normal file
34
Codes/1968 A - Maximize/1968A.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
#ifdef ONLINE_JUDGE
|
||||
#define dbg(...)
|
||||
#else
|
||||
#include "debug.h"
|
||||
#endif
|
||||
#define ll long long
|
||||
#define endl '\n'
|
||||
#define all(x) x.begin(), x.end()
|
||||
#define sz(x) (int)(x).size()
|
||||
#define yes cout << "YES" << endl
|
||||
#define no cout << "NO" << endl
|
||||
#define FAST (ios_base::sync_with_stdio(false), cin.tie(nullptr));
|
||||
ll pow(ll x,ll y,ll m=1e9+7){ll ans=1;x%=m;while(y){if(y&1)ans=(ans*x)%m;x=(x*x)%m;y>>=1;}return ans;}
|
||||
|
||||
void solve()
|
||||
{
|
||||
int n;
|
||||
cin>>n;
|
||||
cout<<n-1<<endl;
|
||||
}
|
||||
|
||||
signed main()
|
||||
{
|
||||
FAST;
|
||||
int TCS = 1;
|
||||
cin >> TCS;
|
||||
for (int TC = 1; TC <= TCS; ++TC)
|
||||
{
|
||||
// cout<<"Case "<<TC<<": ";
|
||||
solve();
|
||||
}
|
||||
}
|
44
Codes/1968 B - Prefiquence/1968B.cpp
Normal file
44
Codes/1968 B - Prefiquence/1968B.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
#ifdef ONLINE_JUDGE
|
||||
#define dbg(...)
|
||||
#else
|
||||
#include "debug.h"
|
||||
#endif
|
||||
#define ll long long
|
||||
#define endl '\n'
|
||||
#define all(x) x.begin(), x.end()
|
||||
#define sz(x) (int)(x).size()
|
||||
#define yes cout << "YES" << endl
|
||||
#define no cout << "NO" << endl
|
||||
#define FAST (ios_base::sync_with_stdio(false), cin.tie(nullptr));
|
||||
ll pow(ll x,ll y,ll m=1e9+7){ll ans=1;x%=m;while(y){if(y&1)ans=(ans*x)%m;x=(x*x)%m;y>>=1;}return ans;}
|
||||
|
||||
void solve()
|
||||
{
|
||||
int n,m;
|
||||
string a,b;
|
||||
cin>>n>>m>>a>>b;
|
||||
int ans=0;
|
||||
for(int i=0,j=0; i<n && j<m; ++j)
|
||||
{
|
||||
if(a[i]==b[j])
|
||||
{
|
||||
ans++;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
cout<<ans<<endl;
|
||||
}
|
||||
|
||||
signed main()
|
||||
{
|
||||
FAST;
|
||||
int TCS = 1;
|
||||
cin >> TCS;
|
||||
for (int TC = 1; TC <= TCS; ++TC)
|
||||
{
|
||||
// cout<<"Case "<<TC<<": ";
|
||||
solve();
|
||||
}
|
||||
}
|
@ -306,8 +306,10 @@ This repository contains my solutions of Codeforces problems. They are in C++ la
|
||||
| 294 | 1957 A | Stickogon | [Question](https://codeforces.com/problemset/problem/1957/A) | [Solution](https://github.com/ShazidMashrafi/Codeforces-Solutions/tree/master/Codes/1957%20A%20-%20Stickogon)
|
||||
| 295 | 1957 B | A BIT of a Construction | [Question](https://codeforces.com/problemset/problem/1957/B) | [Solution](https://github.com/ShazidMashrafi/Codeforces-Solutions/tree/master/Codes/1957%20B%20-%20A%20BIT%20of%20a%20Construction)
|
||||
| 296 | 1957 C | How Does the Rook Move | [Question](https://codeforces.com/problemset/problem/1957/C) | [Solution](https://github.com/ShazidMashrafi/Codeforces-Solutions/tree/master/Codes/1957%20C%20-%20How%20Does%20the%20Rook%20Move)
|
||||
| 297 | 1969 A | Two Friends | [Question](https://codeforces.com/problemset/problem/1969/A) | [Solution](https://github.com/ShazidMashrafi/Codeforces-Solutions/tree/master/Codes/1969%20A%20-%20Two%20Friends)
|
||||
| 298 | 1969 B | Shifts and Sorting | [Question](https://codeforces.com/problemset/problem/1969/B) | [Solution](https://github.com/ShazidMashrafi/Codeforces-Solutions/tree/master/Codes/1969%20B%20-%20Shifts%20and%20Sorting)
|
||||
| 297 | 1968 A | Maximize | [Question](https://codeforces.com/problemset/problem/1968/A) | [Solution](https://github.com/ShazidMashrafi/Codeforces-Solutions/tree/master/Codes/1968%20A%20-%20Maximize)
|
||||
| 298 | 1968 B | Prefiquence | [Question](https://codeforces.com/problemset/problem/1968/B) | [Solution](https://github.com/ShazidMashrafi/Codeforces-Solutions/tree/master/Codes/1968%20B%20-%20Prefiquence)
|
||||
| 299 | 1969 A | Two Friends | [Question](https://codeforces.com/problemset/problem/1969/A) | [Solution](https://github.com/ShazidMashrafi/Codeforces-Solutions/tree/master/Codes/1969%20A%20-%20Two%20Friends)
|
||||
| 300 | 1969 B | Shifts and Sorting | [Question](https://codeforces.com/problemset/problem/1969/B) | [Solution](https://github.com/ShazidMashrafi/Codeforces-Solutions/tree/master/Codes/1969%20B%20-%20Shifts%20and%20Sorting)
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user