Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
98182 | wssdr | 早凉的函数2 | C++ | 解答错误 | 20 | 840 MS | 1824 KB | 637 | 2023-08-14 12:26:00 |
using namespace std; int n;long long a[N]; bool flg;int cnt[10],ans; inline int f(long long x){ int res(0); do{res+=x%10;} while(x/=10); return res; } int main(){ scanf("%d",&n); for(int i(1);i<=n;++i){ scanf("%lld",&a[i]); if(a[i]>9) flg=1; } if(n<=5000) for(int i(1);i<=n;++i) for(int j(1);j<=n;++j) ans+=f(a[i]+a[j]); else{ for(int i(1);i<=n;++i) ans+=2*n*f(a[i]); if(!flg){ for(int i(1);i<=n;++i) ++cnt[a[i]]; for(int i(1),res(0);i<=9;++i){ res+=cnt[10-i]; ans-=9*cnt[i]*res; } } } printf("%d\n",ans); return 0; }
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
200000
4 2 4 4 4 2 3 4 1 0 3 1 2 2 2 4 0 3 1 0 2 3 3 4 4 2 3 1 3 4 4 4 3 4 0 0 1 2 1 4 0 1 3 2 4 2 1 3 2 3 3 0 4 1 2 1 2 4 2 0 2 4 1 3 1 3 3 4 1 2 2 0 2 2 1 2 0 0 2 3 3 3 2 1 2 2 0 1 2 2 2 4 1 4 2 1 ...
566610048
159480400000
exit code: 0, checker exit code: 0
200000
7 7 0 3 8 9 2 7 2 2 1 7 0 6 7 5 0 4 6 5 0 3 8 6 1 6 7 5 8 9 9 4 6 3 4 7 8 1 5 1 7 6 5 9 5 8 4 1 2 5 8 9 6 0 6 0 4 3 2 0 4 4 0 8 0 3 5 1 8 6 3 8 2 3 4 5 1 5 4 2 6 5 9 7 4 8 3 9 6 1 9 0 3 8 6 2 ...
499512035
198068007651
exit code: 0, checker exit code: 0
200000
330204011301132 433002201031030 104033130101412 400432241333231 41214114134332 223301314330001 200302110211134 102142224413031 41244103244140 10114340123133 333200310222433 414104000143001 412...
-1031118464
2399855600000
exit code: 0, checker exit code: 0
200000
620732267142508 960256872286874 334563859004691 238477193858925 565513653856951 263068643259555 108428986362668 883751275926340 717340909768924 682834245218136 150513182148585 938097445144023 ...
-1264458368
2719943371673
exit code: 0, checker exit code: 0