QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#65615#5149. Best Carry Player18067989237TL 4ms7196kbC++141.2kb2022-12-02 13:57:192022-12-02 13:57:21

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-12-02 13:57:21]
  • 评测
  • 测评结果:TL
  • 用时:4ms
  • 内存:7196kb
  • [2022-12-02 13:57:19]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define ll long long
#define fi first
#define se second
#define int long long
#define no "NO\n"
#define yes "YES\n"
#define pb push_back
#define endl "\n"
#define dbg(x...) do{cout<<#x<<" -> ";err(x);}while (0)
void err() { cout << '\n'; }

template<class T, class... Ts>
void err(T arg, Ts... args) {
    cout << arg << ' ';
    err(args...);
}

const int N = 5e5 + 7;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1.0);
int a[N],num[N];
void  solve(){
	  int n;
	  cin >> n;
	  int ans=0;
	  memset(num, 0, sizeof(num));
      for(int i=1;i<=n;++i){
          int x;
	   	  cin >> x;
          for(int j=0; x; x/=10, ++j)
              num[j] += x%10;
        }
        for(int i=0;i<20;++i){
            int cnt = num[i] / 10;
            ans += cnt;
            num[i+1] += cnt;
        }
        cout << ans << '\n';
	  
}

signed main() {
	ios::sync_with_stdio(0);
	cin.tie(nullptr),cout.tie(nullptr);
  	int T=1;
  	cin >>T;
  	while(T--) solve();
    return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 4ms
memory: 7196kb

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: