标签:not BMI several col += acm long strong content
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 504 Accepted Submission(s): 262
讨论左边区间的可能:
1.2018的倍数
2.1009的倍数但不是2018的倍数
3.2的倍数但不是2018的倍数
4. 1的倍数但不是1009与2的倍数
右边区间分别讨论:
1.1的倍数
2.2的倍数
3.1009的倍数
4.2018的倍数
代码:
#include"bits/stdc++.h" #define ll long long #define cl(x) scanf("%lld",&x) #define pl(x) printf("%lld\n",x) using namespace std; int main() { ll a,b,c,d; while(scanf("%lld%lld%lld%lld",&a,&b,&c,&d)==4) { ll ans=0; ll a1,a2,a3; a1=(b/2018)-((a-1)/2018); a1*=d-c+1; a2=b/1009-(a-1)/1009-(b/2018-(a-1)/2018); a2*=d/2-(c-1)/2; a3=b/2-(a-1)/2-(b/2018-(a-1)/2018); a3*=d/1009-(c-1)/1009; ans+=(b-a+1-(b/2-(a-1)/2)-(b/1009-(a-1)/1009)+(b/2018-(a-1)/2018))*(d/2018-(c-1)/2018); ans+=a1+a2+a3; pl(ans); } }
标签:not BMI several col += acm long strong content
原文地址:https://www.cnblogs.com/mj-liylho/p/9383145.html