C. C 九九乘法表 周新然

    Type: Default 1000ms 256MiB

C 九九乘法表 周新然

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
using namespace std;
int k;
int f[4097];
char buf[80000005];
int pos = -1;
inline int add(int x, int y) {
    x += y;
    if (x >> k & 1) {
        x -= (1 << k);
        ++x;
        if (x >> k & 1) {
            x -= (1 << k);
            ++x;
        }
    }
    return x;
}
int stk[11], top = 0;
inline void write(int x) {
    top = 0;
    if (x == 0) stk[++top] = 0;
    while (x) stk[++top] = x % 10, x /= 10;
    per(i, top, 1) buf[++pos] = stk[i] + '0';
}
signed main() {
    scanf("%d", &k);
    rep(i, 0, (1 << k) - 1) {
        rep(j, 0, (1 << k) - 1) {
            // i * j
            if (!i || !j) write(0), buf[++pos] = ' ', f[j] = 0;
            else {
                f[j] = add(f[j - 1], i);
                write(f[j]); buf[++pos] = ' ';
                // printf("%d ", f[i][j]);
            }
        }
        buf[++pos] = '\n';
    }
    fwrite(buf, sizeof(char), pos, stdout);
    return 0;
}

7.31日竞赛3班造数据

Not Attended
Status
Done
Rule
IOI
Problem
8
Start at
2025-7-31 18:00
End at
2025-7-31 21:00
Duration
3 hour(s)
Host
Partic.
8