题解:P16226 [蓝桥杯 2026 省 A] 拦截程序
我们发现,当
::::info[证明]
若
#include<bits/stdc++.h>
#define int __int128
using namespace std;
int C,l,v,t;
inline int read(){
int f=0;char ch=getchar();
while(ch<48||ch>57)ch=getchar();
while(ch>47&&ch<58)f=(f<<3)+(f<<1)+(ch^48),ch=getchar();
return f;
}
void print(int a){
if(a>9)print(a/10);
putchar(a%10+'0');
}
signed main(){
C=read();
while(C--){
int l,v,t;
l=read();
v=read();
t=read();
int L=v*t,R=l-v*t;
int ans=(max(R,L)-min(L,R)+1)/2;
if(ans<0)ans=-ans;
print(ans);
cout<<endl;
}
}
这道题唯一的坑点就在于有可能