OA Help : Interview Help
الذهاب إلى القناة على Telegram
Codeforces Codechef Leetcode AtCoder GFG CodeStudio All Contests Solutions available.
إظهار المزيد898
المشتركون
+124 ساعات
-47 أيام
-1330 أيام
أرشيف المشاركات
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define tc \
int tcc; \
cin >> tcc; \
while (tcc--)
void CHEAT()
{
int n;
cin >> n;
cout << n / 7 + (n % 7 > 1) << endl;
}
signed main()
{
tc
CHEAT();
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
int ans=1;
for(int i=0;i<n;i++){
if(!i) {if(a[i]==ans) ans++; continue;}
ans++;
if(a[i]==ans) ans++;
}
cout<<ans<<endl;
}
}
// A
Kth Index
GCD Sum
Palindrome World
Ninja and Biryani Party
These questions done ✅
int n, x;
bool func(int middle_ele, vi &arr)
{
int req = 0;
for (int i = 0; i < n; i++)
{
if (middle_ele < arr[i])
continue;
req += middle_ele - arr[i];
}
return req <= x;
}
void e()
{
cin >> n >> x;
takeInputArr;
int l = 0, h = 1e13, middle_ele;
while (h - l > 1)
{
middle_ele = (h + l) / 2;
if (func(middle_ele, arr))
l = middle_ele;
else
h = middle_ele - 1;
}
if (func(h, arr))
cout << h << '\n';
else
cout << l << '\n';
}
// E
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int n,k;
cin>>n>>k;
string s;
cin>>s;
int ans = 0;
for(int i=0;i<n;i++){
if(s[i]=='B'){
ans++;
i+=k-1;
}
}
cout<<ans<<endl;
}
return 0;
}
// D
int answer = 0;
for (int i = 0; i < 10; i++)
for (int j = 0; j < 10; j++)
if (v[i][j] == 'X')
answer += min(min(i, j) + 1, 10 - max(i, j));
cout << answer << endl;
// c
void b()
{
int n;
cin >> n;
vector v(n);
for (int i = 0; i < n; i++)
cin >> v[i];
int answer = 0;
for (int i = 0; i < n; i++)
{
int currentProduct = 1;
v[i]++;
for (int j : v)
currentProduct *= j;
answer = max(answer, currentProduct);
v[i]--;
}
cout << answer << endl;
}
// B
