QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#189277 | #3722. 2017 | Cidoai# | AC ✓ | 3ms | 1492kb | C++20 | 698b | 2023-09-27 08:04:13 | 2023-09-27 08:04:14 |
Judging History
answer
#include<cstdio>
typedef long long ll;
inline ll read(){
ll x=0;
int f=0,ch=0;
while(ch<48||ch>57) f=(ch=='-'),ch=getchar();
while(ch>47&&ch<58) x=(x<<3)+(x<<1)+(ch&15),ch=getchar();
return f?-x:x;
}
inline void write(ll x,char end=' '){
if(x==0){
putchar('0');
putchar(end);
return;
}
if(x<0) putchar('-'),x=-x;
int ch[70]={0},cnt=0;
while(x){
ch[cnt++]=(int)(x%10);
x/=10;
}
while(cnt--) putchar(ch[cnt]+48);
putchar(end);
}
ll ans;
ll a,b,c,d;
int main(){
while(~scanf("%lld",&a)){
b=read(),c=read(),d=read();
ll x=b/2017-(a-1)/2017;
ll y=d/2017-(c-1)/2017;
ll ans=x*(d-c+1-y)+y*(b-a+1-x)+x*y;
write(ans,'\n');
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 1492kb
input:
657566422 885255954 448993422 666465506 458282444 756101506 350414894 783903861 780975914 902703074 453374141 986255693 94558083 121905007 7212181 480096950 110322930 812575433 244899505 686704831 226538966 341149232 102321875 194809116 553489234 741264907 599873654 776794417 477987278 619201381 453...
output:
49086650502585 127981757234584 64303697473053 12819679604810 307567863166426 10508043731954 32933192774614 45732157630992 24864680661036 35204017360992 132954385494629 178059940617418 211646726664373 8366935398060 47338241946190 116610929800533 181437148566555 17267342947320 150774601552882 50733758...
result:
ok 10000 numbers