C. Physical Education Lesson
1.C. Insert and Equalize2.C. Removal of Unattractive Pairs3.D. Jumping Through Segments4.E. Good Triples5.F. Shift and Reverse6.D. Yet Another Monster Fight7.A. Constructive Problems8.C. Game with Multiset9.A. Rating Increase10.B. Swap and Delete11.A. Problemsolving Log12.B. Preparing for the Contest13.C. Quests14.D. Three Activities15.E2. Game with Marbles (Hard Version)16.cf刷题有感17.A. Anonymous Informant18.A. Forked!19.B. Make Almost Equal With Mod20.C. Heavy Intervals21.D. Split Plus K22.A. 202323.B. Two Divisors24.C. Training Before the Olympiad25.D. Mathematical Problem26.F. Greetings27.C. Partitioning the Array28.G. Bicycles29.E. Eat the Chip30.G. Lights31.D. Array Repetition32.D. Berserk Monsters33.E. Increasing Subsequences34.D. Very Different Array35.G. Mischievous Shooter36.B. Plus-Minus Split37.B. A Balanced Problemset38.C. Did We Get Everything Covered39.D. Find the Different Ones!40.C. Grouping Increases41.D. Good Trip
42.C. Physical Education Lesson
43.E. Final Countdown44.D. Divisible Pairs45.G. Vlad and Trouble at MIT46.A. Brick Wall47.B. Minimize Inversions48.C. XOR-distance49.A. Moving Chips50.B. Monsters Attack!51.C. Find B52.D. Slimes53.C. Turtle Fingers: Count the Values of k54.D. Turtle Tenacity: Continual Mods55.D. Vlad and Division56.C. LR-remainders57.D. Lonely Mountain Dungeons题解
再结合代码应该就能看得懂了吧。。。
至于赛时怎么想出来的。我是观察样例得出来的
时间复杂度
code
#include<bits/stdc++.h>
#define ll long long
using namespace std;
inline void read(ll &x) {
x = 0;
ll flag = 1;
char c = getchar();
while(c < '0' || c > '9'){
if(c == '-') flag = -1;
c = getchar();
}
while(c >= '0' && c <= '9') {
x = (x << 3) + (x << 1) + (c ^ 48);
c = getchar();
}
x *= flag;
}
inline void write(ll x)
{
if(x < 0){
putchar('-');
x = -x;
}
if(x > 9)
write(x / 10);
putchar(x % 10 + '0');
}
int main()
{
ll t;
read(t);
while(t--)
{
ll n,x;
read(n); read(x);
set<ll> q;
ll a=n+x-2, b=n-x;
for(ll i=1; i*i<=a; i++)
{
ll j=a/i;
if(a%i==0 && i%2==0 && ((i+2)>>1) >= x)
{
q.insert((i+2)>>1);
}
if(a%j==0 && j%2==0 && ((j+2)>>1) >= x)
{
q.insert((j+2)>>1);
}
}
for(ll i=1; i*i<=b; i++)
{
ll j=b/i;
if(b%i==0 && i%2==0 && ((i+2)>>1) >= x)
{
q.insert((i+2)>>1);
}
if(b%j==0 && j%2==0 && ((j+2)>>1) >= x)
{
q.insert((j+2)>>1);
}
}
write(q.size());
putchar('\n');
}
return 0;
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~