QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#609580#5149. Best Carry PlayerzakeWA 13ms3640kbC++17557b2024-10-04 13:29:082024-10-04 13:29:10

Judging History

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

  • [2024-10-04 13:29:10]
  • 评测
  • 测评结果:WA
  • 用时:13ms
  • 内存:3640kb
  • [2024-10-04 13:29:08]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
int a[100005]; 
void solve()
{
	int n;
	cin>>n;
	for(int i=0;i<n;++i)
	{
		cin>>a[i];
	}
	int ans=0;
	for(int i=0;i<n-1;++i)
	{
		int k=1,p=0;
		int j=0;
		while(a[i]>0||j>0)
		{
			
			int x=a[i]%10+a[i+1]%10+j;
			a[i]/=10;
			a[i+1]/=10;
			j=x/10;
			if(j>0) ans++;
			p+=k*(x%10);
			k*=10;
		}
		a[i+1]=p;
	}
	cout<<ans<<"\n";
}
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	cin>>t;
	while(t--) solve();
} 

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3612kb

input:

2
3
9 99 999
1
12345

output:

5
0

result:

ok 2 number(s): "5 0"

Test #2:

score: 0
Accepted
time: 10ms
memory: 3640kb

input:

100000
1
481199252
1
634074578
1
740396295
1
579721198
1
503722503
1
202647942
1
268792718
1
443917727
1
125908043
1
717268783
1
150414369
1
519096230
1
856168102
1
674936674
1
274667941
1
527268921
1
421436316
1
286802932
1
646837311
1
451394766
1
105650419
1
302790137
1
254786900
1
76141081
1
7393...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 numbers

Test #3:

score: -100
Wrong Answer
time: 13ms
memory: 3564kb

input:

10000
10
598196518 640274071 983359971 71550121 96204862 799843967 446173607 796619138 402690754 223219513
10
312183499 905549873 673542337 566661387 879397647 434495917 631413076 150918417 579868000 224422012
10
525305826 535526356 404334728 653535984 998133227 879226371 59632864 356493387 62611196...

output:

42
41
42
35
43
35
44
38
39
46
31
40
42
38
38
41
39
39
37
42
38
41
38
42
41
39
40
45
35
41
37
40
41
41
40
35
50
39
42
33
44
43
46
41
35
42
39
41
39
38
34
44
39
43
38
40
41
36
35
45
37
39
40
41
43
43
41
43
40
42
36
41
38
43
40
40
42
42
41
40
37
41
36
40
41
40
44
35
37
43
40
36
36
43
41
41
43
44
32
38
...

result:

wrong answer 66th numbers differ - expected: '44', found: '43'