Please sign in first.
Submission #52661942
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(x) (x).begin(), (x).end()
bool be;
int a[5] = {6, 2, 4, 8};
inline int t(ll x)
{
return (x == 0 ? 1 : a[x % 4]);
}
bool en;
int main() {
cerr << (&be - &en) / 1024.0 / 1024 << " MB\n--------------------------------" << endl;
#ifdef IAKIOI
freopen("in.in", "r", stdin);
// freopen("out.out", "w", stdout);
#endif
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
while (T--) {
ll n, m, k;
cin >> n >> m >> k;
if (m - k == 1) {
cout << (n >= k ? 0 : t(n)) << '\n';
continue;
}
if (n >= k) {
ll x = n - k, y = m - k;
x %= y;
cout << t(x + k) << '\n';
} else {
cout << t(n) << '\n';
}
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Simple Math 4 |
| User | lfxxx |
| Language | C++ 17 (gcc 12.2) |
| Score | 400 |
| Code Size | 851 Byte |
| Status | AC |
| Exec Time | 29 ms |
| Memory | 3888 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 400 / 400 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example_00.txt |
| All | example_00.txt, test_00.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| example_00.txt | AC | 1 ms | 3748 KiB |
| test_00.txt | AC | 29 ms | 3888 KiB |
| test_01.txt | AC | 29 ms | 3720 KiB |
| test_02.txt | AC | 28 ms | 3712 KiB |
| test_03.txt | AC | 19 ms | 3732 KiB |
| test_04.txt | AC | 19 ms | 3588 KiB |
| test_05.txt | AC | 18 ms | 3756 KiB |
| test_06.txt | AC | 29 ms | 3756 KiB |
| test_07.txt | AC | 28 ms | 3588 KiB |