QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#82618 | #5528. Least Annoying Constructive Problem | zhaohaikun | WA | 0ms | 3312kb | C++14 | 1.0kb | 2023-02-28 14:31:51 | 2023-02-28 14:31:54 |
Judging History
answer
#include <bits/stdc++.h>
#define SZ(x) (int) x.size() - 1
#define all(x) x.begin(), x.end()
#define ms(x, y) memset(x, y, sizeof x)
#define F(i, x, y) for (int i = (x); i <= (y); i++)
#define DF(i, x, y) for (int i = (x); i >= (y); i--)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template <typename T> void chkmax(T &x, T y) { x = max(x, y); }
template <typename T> void chkmin(T &x, T y) { x = min(x, y); }
template <typename T> void read(T &x) {
x = 0; int f = 1; char c = getchar();
for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
x *= f;
}
int n;
int calc(int x) {
return (x + n - 1) % n + 1;
}
signed main() {
cin >> n;
if (n & 1) {
int k = n / 2;
F(i, 1, n) {
F(j, 1, k) cout << calc(i - j + 1) << " " << calc(i + j) << endl;
}
return 0;
}
n--;
int k = n / 2;
F(i, 1, n - 1) {
F(j, 1, k) cout << calc(i - j + 1) << " " << calc(i + j) << endl;
cout << calc(i + k + 1) << " " << n + 1 << endl;
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3312kb
input:
3
output:
1 2 2 3 3 1
result:
wrong answer Integer 1 violates the range [4, 3]