| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 480514 | rainboy | Popcount (COCI19_popcount) | C++17 | 3 ms | 204 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#include <string.h>
#define N	500
#define L	256
void mult2(int *aa) {
	int h;
	for (h = 0; h < L; h++)
		if ((aa[h] *= 2) >= 10)
			aa[h] -= 10, aa[h + 1]++;
}
void add1(int *aa) {
	int h;
	aa[0] += 1;
	for (h = 0; h < L; h++)
		if (aa[h] >= 10)
			aa[h] -= 10, aa[h + 1]++;
}
int main() {
	static int aa[L];
	static char cc[N + 1];
	int n, m, l, i;
	scanf("%d%*d", &n);
	for (m = 1; m < n; m <<= 1) {
		memset(aa, 0, L * sizeof *aa);
		for (i = n - 1; i >= 0; i--) {
			mult2(aa);
			if (i % (m * 2) < m)
				add1(aa);
		}
		l = L;
		while (l > 1 && aa[l - 1] == 0)
			l--;
		for (i = l - 1; i >= 0; i--)
			cc[l - 1 - i] = aa[i] + '0';
		printf("A=(A&%s)+((A>>%d)&%s)\n", cc, m, cc);
	}
	return 0;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
