QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#749590 | #8340. 3 Sum | Insert_Username_Here | WA | 0ms | 3776kb | C++20 | 1.2kb | 2024-11-15 05:34:23 | 2024-11-15 05:34:24 |
Judging History
answer
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
const ll mod = 1e9 + 7;
// #include <brawlstars>
// FOR PAIN OR FOR GLORYYY ELLL PRIMOOOOOO
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
ll n, k;
cin >> n >> k;
string s;
ll tmp[k], a[n], bk;
for(ll i = 0; i < n; i++) {
cin >> s;
reverse(s.begin(), s.end());
for(ll j = 0; j < k; j++) tmp[j] = 0;
for(ll j = 0; j < (int)s.size(); j++) tmp[j % k] += s[j] - '0';
bk = 0;
for(ll j = 0; j < k; j++) tmp[j] += bk, bk = tmp[j] / 10, tmp[j] %= 10;
while(bk) {
for(ll j = 0; j < k; j++) tmp[j] += bk, bk = tmp[j] / 10, tmp[j] %= 10;
}
a[i] = 0;
for(ll j = k - 1; j >= 0; j--) a[i] = (a[i] * 10 + tmp[j]) % mod;
}
for(int i = 0; i < n; i++) cout << a[i] << " ";
cout << "\n";
bk = 0;
for(ll i = 0; i < k; i++) bk = (bk * 10 + 9) % mod;
ll ans = 0, cur;
for(ll i = 0; i < n; i++) {
for(ll j = i; j < n; j++) {
for(ll k = j; k < n; k++) {
cur = a[i] + a[j] + a[k];
if(cur == 0 || cur == bk || cur == 2 * bk % mod || cur == 3 * bk % mod) {
ans++;
break;
}
}
}
}
cout << ans << "\n";
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3776kb
input:
4 1 0 1 10 17
output:
0 1 1 8 3
result:
wrong answer 1st numbers differ - expected: '3', found: '0'