Parallel 2 (DHBB 2021 T.Thử)
n = int(input())
for _ in range(n):
i, f = map(int, input().split())
if (i <= 1 and f <= 2) or (i <= 2 and f <= 1):
print("Yes")
else:
print("No")
Ước số của n
include<bits/stdc++.h>
define ll long long
define ld long double
define f(i, a, b) for(ll i=(a); i<=(b); ++i)
using namespace std;
int main (){
cin.tie(nullptr)->sync_with_stdio(false);
ll n;
vector<ll> a;
cin >> n;
f(i, 1, sqrt(n)){
if(n%i==0){
a.push_back(i);
if(n/i!=i) a.push_back(n/i);
}
}
sort(a.begin(), a.end());
for(auto i:a) cout << i << " ";
return 0;
}
Xóa chữ số
Code SEGG
nhin cc
include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
string s; int k,i,j,tmp,d=0;
cin>>s>>k;
int n = s.size();
char a[n+1];
int top = 0;
for(int i=0;i<n;i++) { while (top>0 && k>0 && a[top-1]<s[i]) top--,k--;
a[top++] = s[i];
}
while (k--) top--;
for(int i=0;i<top;i++) cout<<a[i];
}
Xóa chữ số
include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
string s; int k,i,j,tmp,d=0;
cin>>s>>k;
int n = s.size();
char a[n+1];
int top = 0;
for(int i=0;i<n;i++)
{
while (top>0 && k>0 && a[top-1]<s[i]) top--,k--;
a[top++] = s[i];
}
while (k--) top--;
for(int i=0;i<top;i++) cout<<a[i];
}
Xóa chữ số
code nhé ae
include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
string s; int k,i,j,tmp,d=0;
cin>>s>>k;
int n = s.size();
char a[n+1];
int top = 0;
for(int i=0;i<n;i++)
{
while (top>0 && k>0 && a[top-1]<s[i]) top--,k--;
a[top++] = s[i];
}
while (k--) top--;
for(int i=0;i<top;i++) cout<<a[i];
//chu code dz vlxx
}
Cây thông (Contest ôn tập #02 THTA 2023)
n=int(input())
sodau=n+n+1
socuoi=(n*(n+1))
print(sodau+socuoi)