QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#749590#8340. 3 SumInsert_Username_HereWA 0ms3776kbC++201.2kb2024-11-15 05:34:232024-11-15 05:34:24

Judging History

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

  • [2024-11-15 05:34:24]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3776kb
  • [2024-11-15 05:34:23]
  • 提交

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'