QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#75382#5149. Best Carry Playerchris_pherTL 0ms3360kbC++23526b2023-02-05 03:46:482023-02-05 03:46:49

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-05 03:46:49]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:3360kb
  • [2023-02-05 03:46:48]
  • 提交

answer

#include <bits/stdc++.h> 
typedef long long ll;
using namespace std;
const int N = 100010;

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	int T;
	cin >> T;
	while(T--) {
		int n;
		ll ans = 0,sum = 0;
		cin >> n;
		for(int i = 0;i < n;i++) {
			ll x;
			cin >> x;
			string s = to_string(x);
			for(auto i : s) {
				ans += i - '0';
			}
			sum += x;
		}
		string s = to_string(sum);
		for(auto i : s) {
			ans -= i -'0';
		}
		cout << ans / 9 << endl;
	}
	return 0;
}

詳細信息

Test #1:

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

input:

2
3
9 99 999
1
12345

output:

5
0

result:

ok 2 number(s): "5 0"

Test #2:

score: -100
Time Limit Exceeded

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: