QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#292631#4904. 圆滚滚的算术占卜_yjh0 2227ms3428kbC++14813b2023-12-28 09:54:142023-12-28 09:54:15

Judging History

你现在查看的是最新测评结果

  • [2023-12-28 09:54:15]
  • 评测
  • 测评结果:0
  • 用时:2227ms
  • 内存:3428kb
  • [2023-12-28 09:54:14]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef double db;
inline ll read() {
	ll x=0,f=1;char ch=getchar();
	while(!isdigit(ch)) {if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)) {x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	return x*f;
}
const ll p=998244353;
ll T,l,r,fnl;
ll calc(ll n) {
	ll ans=n;
    while(n>=10) {
    	int tmp=n,sum=0;
        while(tmp) {
        	sum+=tmp%10;
    		tmp/=10;
		}
		n-=sum;tmp=n;
		while(tmp) {
			ans*=10;
			tmp/=10;
		}
		(ans+=n)%=p;
	} 
	return ans;
}
int main() {
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
    T=read();
    while(T--) {
    	l=read(),r=read(),fnl=0;
    	for(ll i=l;i<=r;i++) (fnl+=calc(i))%=p;
    	cout<<fnl<<'\n';
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 0
Time Limit Exceeded

input:

10
9653 62002
91160 95589
4602 60141
54240 79592
69170 95623
46733 68190
25361 84435
23506 99583
62553 65996
22099 81703

output:


result:


Subtask #2:

score: 0
Time Limit Exceeded

Test #4:

score: 10
Accepted
time: 689ms
memory: 3372kb

input:

5
14151615 14151615
50959220 50959220
177962208 177962208
173507309 173507309
608527742 608527742

output:

574888399
728657674
419976531
502012045
456375259

result:

ok 5 number(s): "574888399 728657674 419976531 502012045 456375259"

Test #5:

score: 0
Accepted
time: 1159ms
memory: 3428kb

input:

5
441384319 441384319
606726578 606726578
100872719 100872719
290542038 290542038
290435521 290435521

output:

304014472
49910017
871510667
927387471
830052470

result:

ok 5 number(s): "304014472 49910017 871510667 927387471 830052470"

Test #6:

score: 0
Accepted
time: 1564ms
memory: 3428kb

input:

5
686934834 686934834
217972715 217972715
91760217 91760217
478910665 478910665
871116356 871116356

output:

95543981
675033334
382398698
617891543
7219851

result:

ok 5 number(s): "95543981 675033334 382398698 617891543 7219851"

Test #7:

score: 0
Accepted
time: 2227ms
memory: 3424kb

input:

5
632445684 632445684
734428390 734428390
713862928 713862928
749060122 749060122
542269196 542269196

output:

651099756
192673041
504124590
272521896
299385724

result:

ok 5 number(s): "651099756 192673041 504124590 272521896 299385724"

Test #8:

score: 0
Accepted
time: 911ms
memory: 3300kb

input:

5
292694554 292694554
122280051 122280051
174892392 174892392
9910543 9910543
784522094 784522094

output:

419465926
714229591
283421374
481713044
109145296

result:

ok 5 number(s): "419465926 714229591 283421374 481713044 109145296"

Test #9:

score: 0
Accepted
time: 1777ms
memory: 3420kb

input:

5
615497298 615497298
564113448 564113448
753391603 753391603
551814992 551814992
174017428 174017428

output:

22576684
137456470
513923958
668473835
317575304

result:

ok 5 number(s): "22576684 137456470 513923958 668473835 317575304"

Test #10:

score: -10
Time Limit Exceeded

input:

5
1000000000 1000000000
999999999 999999999
999999998 999999998
999999997 999999997
999999996 999999996

output:


result:


Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%

Subtask #6:

score: 0
Skipped

Dependency #5:

0%