ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#193886 | #3398. count | WilliamFranklin | 100 | 18ms | 2820kb | C++11 | 985b | 2023-10-14 18:04:24 | 2023-10-14 18:40:28 |
answer
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define mp(Tx, Ty) make_pair(Tx, Ty)
#define For(Ti, Ta, Tb) for(auto Ti = (Ta); Ti <= (Tb); Ti++)
#define Dec(Ti, Ta, Tb) for(auto Ti = (Ta); TI >= (Tb); Ti--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define range(Tx) begin(Tx),end(Tx)
const int N = 1e5 + 5, mod = 1e9 + 7;
long long a[N];
int n;
long long sum;
long long it[N];
long long sum1;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
cin >> n;
For(i, 1, n) cin >> a[i];
For(i, 1, n) {
int cnt = 0;
long long b = a[i];
while (b) {
b /= 10;
cnt++;
}
long long now = 1;
while (cnt) {
now = now * 10 % mod;
cnt--;
}
it[i] = now;
sum = (sum + now) % mod;
sum1 = (a[i] + sum1) % mod;
}
long long ans = 0;
For(i, 1, n) {
ans = (((ans + (sum - it[i] + mod) % mod * a[i] % mod) % mod + (sum1 - a[i] + mod) % mod) % mod) % mod;
}
cout << ans;
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 20
Accepted
time: 0ms
memory: 1280kb
input:
1000 332109541 265698305 339007233 386487277 65597920 217218907 436378017 221884663 270433433 268014...
output:
675688319
result:
ok single line: '675688319'
Test #2:
score: 20
Accepted
time: 1ms
memory: 1276kb
input:
1000 108652253 396843081 18739163 168730297 41598432 22132831 155692945 617160601 164753707 86147692...
output:
653845876
result:
ok single line: '653845876'
Test #3:
score: 20
Accepted
time: 0ms
memory: 1276kb
input:
1000 71158753 11073019 119630785 162780801 25368543 517705 123835636 254874371 4127795 157084999 201...
output:
126629477
result:
ok single line: '126629477'
Test #4:
score: 20
Accepted
time: 0ms
memory: 1276kb
input:
1000 496106605 30223789 139619196 52432001 12405522 405765988 35664524 102798391 192246625 760951562...
output:
891456070
result:
ok single line: '891456070'
Test #5:
score: 20
Accepted
time: 17ms
memory: 2820kb
input:
100000 227552529 170886571 513851125 46675201 188079376 255537313 266819605 69661658 214521435 33384...
output:
677195751
result:
ok single line: '677195751'