3 条题解
-
0
int main() #define int long long { int t; int a,b,c,d; scanf("%lld",&t); while(t--){ scanf("%lld%lld%lld%lld",&a,&b,&c,&d); int x2=(b/2)-(a-1)/2; int y2=(d/2)-(c-1)/2; int x1013=(b/1013)-(a-1)/1013; int y1013=(d/101sb3)-(c-1)/1013; int x2026=(b/2026)-(a-1)/2026; int y2026=(d/2026)-(c-1)/2026; int sum=0; sum=(x2-x2026)*(y101oo3-y2026); sum=sum+(y2-y2026)*(x1013-x2026); sum=sum+x2026*(d-c+1); sum=sum+y2026*(b-a+1)-x2026*y2026; printf("%lld\n",sum);; } return 0; } -
0
#include<iostream> #include<algorithm> #include<cmath> #define ll long long using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll t,a,b,c,d; cin>>t; while(t--){ ll sum=0; cin>>a>>b>>c>>d; ll L2=b/2-(a-1)/2; ll L1013=b/1013-(a-1)/1013; ll L2026=b/2026-(a-1)/2026; ll R2=d/2-(c-1)/2; ll R1013=d/1013-(c-1)/1013; ll R2026=d/2026-(c-1)/2026; sum=L2026*(d-c+1)+(L2-L2026)*R1013+(L1013-L2026)*R2+((b-a+1)-L2-L1013+L2026)*R2026; // l是2026倍数,r任意 // l是2不是1013,r1013倍数 // l是1013不是2026,r偶数 // l不是2不是1013但前两个都包含2026所需再加2026,r2026 cout<<sum<<"\n"; } return 0; } -
0
void solve() { int a,b,c,d; cin >> a >> b >> c >> d; int ans = 0; int x2 = b/2 - (a-1)/2; int x1013 = b/1013 - (a-1)/1013; int x2026 = b/2026 - (a-1)/2026; int y2 = d/2 - (c-1)/2; int y1013 = d/1013 - (c-1)/1013; int y2026 = d/2026 - (c-1)/2026; ans += x2026 * (d -c +1); ans += y2026 * (b -a +1); ans += (x2 - x2026) * (y1013 - y2026); ans += (x1013 - x2026) * (y2 - y2026); cout << ans - (x2026 * y2026) << endl; }
- 1
信息
- ID
- 1170
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 8
- 标签
- (无)
- 递交数
- 185
- 已通过
- 27
- 上传者