C. Physical Education Lesson
原题链接:Problem - 1928C - Codeforces
题目大意:
类似于一个站队,像金字塔一样的标号,说实话没有样例解释,估计理解起来会特别费劲。
题目做法:
m(k-1)=n-(k-1)或者m(k-1)=n+(k-1)求k的个数,理所应当想到因数
简单的思路,很烂的调试能力,非常好的体验,稀巴烂的代码
AC代码:
#include<bits/stdc++.h>
#define pb(element) push_back(element)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
//#define int long long
//#define ll long long
//Cara's templet version 1.19
//2024/2/20 20:32 UTC+8
//Blood Toil Tears Sweat
using namespace std;
const int maxn=2e5+10;
void solve()
{
int n,k;
set<int> res;
cin>>n>>k;
n-=1;
for(int i=1;i<=(n+(k-1))/i;i++)
{
if((n+(k-1))%i==0)
{
if(i+1>=k&&((n+(k-1))/i)%2==0) res.insert(i+1);
if((n+(k-1))/i+1>=k&&i%2==0) res.insert((n+(k-1))/i+1);
}
}
for(int i=1;i<=(n-(k-1))/i;i++)
{
if((n-(k-1))%i==0)
{
if(i+1>=k&&((n-(k-1))/i)%2==0) res.insert(i+1);
if((n-(k-1))/i+1>=k&&i%2==0) res.insert((n-(k-1))/i+1);
}
}
cout<<res.size()<<'\n';
}
signed main()
{
fast int casen=1;
cin>>casen;
while(casen--) solve();
}
B. Equalize
题目大意:
题目做法:
我是傻逼
AC代码:
#include<bits/stdc++.h>
#define pb(element) push_back(element)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define int long long
//#define ll long long
//Cara's templet version 1.19
//2024/2/20 20:32 UTC+8
//Blood Toil Tears Sweat
using namespace std;
const int maxn=2e5+10;
void solve()
{
int n,res=1,tres=1,lps=0;
cin>>n;
int ar[n+10];
vector<int> newa;
for(int i=0;i<n;i++)
{
cin>>ar[i];
}
sort(ar,ar+n);
newa.pb(ar[0]);
for(int i=1;i<n;i++)
{
if(ar[i]!=ar[i-1])
{
newa.pb(ar[i]);
}
}
int i;
for(i=0;i<newa.size();i++)
{
int gofind=newa[i]-(n-1);
int sps=lower_bound(newa.begin(),newa.end(),gofind)-newa.begin();
res=max(i-sps+1,res);
}
cout<<res<<'\n';
}
signed main()
{
fast int casen=1;
cin>>casen;
while(casen--) solve();
}
A. Rectangle Cutting
题目大意:
题目做法:
就两种情况
AC代码:
#include<bits/stdc++.h>
#define pb(element) push_back(element)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define int long long
//#define ll long long
//Cara's templet version 1.19
//2024/2/20 20:32 UTC+8
//Blood Toil Tears Sweat
using namespace std;
const int maxn=2e5+10;
void solve()
{
int a[2];
cin>>a[0]>>a[1];
sort(a,a+2);
int a1[2],a2[2];
a1[0]=a[0]/2,a1[1]=a[1]*2,a2[0]=a[0]*2,a2[1]=a[1]/2;
sort(a1,a1+2);
sort(a2,a2+2);
if(a1[0]*a1[1]==a[0]*a[1])
{
if(a1[0]!=a[0])
{
cout<<"YES"<<'\n';
return ;
}
}
if(a2[0]*a2[1]==a[0]*a[1])
{
if(a2[0]!=a[0])
{
cout<<"YES"<<'\n';
return ;
}
}
cout<<"NO"<<'\n';
}
signed main()
{
fast int casen=1;
cin>>casen;
while(casen--) solve();
}