QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#65611 | #5149. Best Carry Player | 18067989237 | WA | 17ms | 5416kb | C++14 | 1.6kb | 2022-12-02 13:46:57 | 2022-12-02 13:46:58 |
Judging History
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],b[N],c[N],cnt;
string cal(string A, string B){
int len = max(A.size(), B.size());
for (int i = A.size() - 1, j = 1; i >= 0; i--, j++)
a[j] = A[i] - '0';
for (int i = B.size() - 1, j = 1; i >= 0; i--, j++)
b[j] = B[i] - '0';
for(int i=1;i<=len;i++) c[i]=0;
for (int i = 1; i <= len; i++) {
c[i] += a[i] + b[i];
c[i + 1] = c[i] / 10;
if(c[i]>=10) cnt++;
c[i] %= 10;
}
if (c[len + 1])
len++;
string x;
for (int i = len; i >= 1; i--)
x+= c[i]+'0';
return x;
}
void solve(){
int n;
cin >> n;
string s,t,sum;
cin >> sum;
cnt=0;
for(int i=1;i<n;i++){
cin >> s;
sum = cal(sum,s);
}
cout << cnt << endl;
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(nullptr),cout.tie(nullptr);
int T=1;
cin >>T;
while(T--) solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 3ms
memory: 5416kb
input:
2 3 9 99 999 1 12345
output:
5 0
result:
ok 2 number(s): "5 0"
Test #2:
score: 0
Accepted
time: 17ms
memory: 3428kb
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: 11ms
memory: 5348kb
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:
43 41 43 35 43 36 45 38 39 46 31 42 43 39 39 42 40 39 37 42 38 42 41 42 42 40 40 45 38 43 39 41 41 42 42 35 50 39 43 33 45 43 46 41 36 43 40 41 40 38 34 44 40 44 39 41 42 36 35 45 37 39 40 41 43 46 41 43 40 43 38 42 38 43 41 40 42 43 42 40 38 41 37 42 41 40 44 35 38 44 41 36 36 43 41 41 44 45 32 38 ...
result:
wrong answer 1st numbers differ - expected: '42', found: '43'