QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#372548#8340. 3 Sumzzuqy#WA 1ms4216kbC++142.8kb2024-03-31 15:18:172024-03-31 15:18:18

Judging History

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

  • [2024-09-20 10:20:30]
  • hack成功,自动添加数据
  • (/hack/848)
  • [2024-03-31 15:18:18]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4216kb
  • [2024-03-31 15:18:17]
  • 提交

answer

#include <bits/stdc++.h>
#define fep(A,B,C) for(int C=A;C>=B;--C)
#define rep(A,B,C) for(int C=A;C<=B;++C)
#define ll long long
#define sc(k) scanf("%d",&k)
#define put(A) printf("%d\n",A)
using namespace std;
const int MAXN = 510;
#define int ll
int T, n;
int a[MAXN][10];
int k[10];
int mod[10];
int b[20010];

int calc(int *a, int *b, int n) {
	std::memset(b, 0, 20005 * sizeof(b[0]));
	for (int i = 0; i < n; i += T) {
		for (int j = 1; j <= T && i + j <= n; j++) {
			b[j] += a[i + j];
		}
		for (int j = 1;; j++) {
			b[j + 1] += b[j] / 10;
			b[j] %= 10;
			if (b[j])
				b[0] = std::max(b[0], j);
			if (b[j + 1])
				b[0] = std::max(b[0], j + 1);
			if (j >= b[0])
				break;
		}
	}
	int ans = b[0];
	b[0] = 0;
	return ans;
}

signed main() {
//	freopen("1.in", "r", stdin);
	sc(n);
	mod[1] = 1000000000000000003;
	mod[2] = 1000000000000001537;
	mod[3] = 100000000000001459;
	mod[4] = 1000000000000002493;
	mod[5] = 100000000000001093;

	sc(T);
//	if (T <= 18) {
//		ll M = 1;
//		rep(1, T, i)M = M * 10;
//		M -= 1;
//		static char s[20006];
//		rep(1, n, ww) {
//			scanf("%s", s + 1);
//			int len = strlen(b + 1);
//			rep(1, len, i) {
//				rep(1, 1, j)
//				a[ww][j] = ((ll)a[ww][j] * 10 + (b[i] - '0')) % M;
//			}
//		}
//		int ans = 0;
//		rep(1, n, i)rep(i, n, j)rep(j, n, K) {
//			int flag = 1;
//			rep(1, 1, cc) {
//				if (((ll)a[i][cc] + a[j][cc] + a[K][cc]) % M) {
//					flag = 0;
//					break;
//				}
//			}
//			ans += flag;
//		}
//		put(ans);
//		return 0;
//	}
	rep(1, 5, j)k[j] = 1;
	rep(1, T, i) {
		rep(1, 5, j)
		k[j] = ((ll)k[j] * 10) % mod[j];
	}
	rep(1, 5, j)k[j] = (k[j] - 1 + mod[j]) % mod[j];
	static int tmp[20006];
	static char s[20006];
	rep(1, n, ww) {
		scanf("%s", s + 1);
		int len = strlen(s + 1);
		for (int i = 1, j = len; i < j; i++, j--)
			swap(s[i], s[j]);
		for (int i = 1; i <= len; i++)
			b[i] = s[i] - '0';
		int lenn = len;
		while (len > T) {
			len = calc(b, tmp, len);
			std::memcpy(b, tmp, 20005 * sizeof(b[0]));
		}
		for (int i = len; i; i--) {
			rep(1, 5, j)
			a[ww][j] = ((ll)a[ww][j] * 10 + (b[i])) % mod[j];
		}
	}
	for (int i = 1; i <= n; i++)
		printf(">>>%d\n", a[i][1]);
	int ans = 0;
	rep(1, n, i)rep(i, n, j)rep(j, n, K) {
		int flag = 1;
		rep(1, 5, cc) {
			if (((ll)a[i][cc] + a[j][cc] + a[K][cc]) % mod[cc] != k[cc]) {
				flag = 0;
				break;
			}

		}
		if (flag)
			ans += flag;
		else {
			flag = 1;
			rep(1, 5, cc) {
				if (((ll)a[i][cc] + a[j][cc] + a[K][cc]) % mod[cc] != 2 * k[cc] % mod[cc]) {
					flag = 0;
					break;
				}

			}
			if (flag)
				ans += flag;
			else {
				flag = 1;
				rep(1, 5, cc) {
					if (((ll)a[i][cc] + a[j][cc] + a[K][cc]) % mod[cc] != 0) {
						flag = 0;
						break;
					}

				}
				ans += flag;
			}
		}
	}
	put(ans);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 4216kb

input:

4 1
0
1
10
17

output:

>>>0
>>>1
>>>1
>>>8
3

result:

wrong output format Expected integer, but ">>>0" found