QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#759862 | #9628. 骰子 | xyz# | AC ✓ | 0ms | 3708kb | C++23 | 738b | 2024-11-18 12:48:22 | 2024-11-18 12:48:22 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int get(int x, int y) {
x = (x - 1) % 6;
y = (y - 1) % 6;
int p[7] = {0, 1, 2, 3, 4, 5, 6};
for (int i = 1; i <= x; i++) {
int a = p[1], b = p[3], c = p[6], d = p[4];
p[1] = d, p[3] = a, p[6] = b, p[4] = c;
}
for (int j = 1; j <= y; j++) {
int a = p[1], b = p[2], c = p[6], d = p[5];
p[1] = d, p[2] = a, p[6] = b, p[5] = c;
}
return p[6];
}
int main() {
int n, m;
cin >> n >> m;
int sum = 0;
if (n < 2 || m < 2) {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
//cout << "get(" << i << "," << j << ")=" << get(i, j) << endl;
sum += get(i, j);
}
}
} else {
sum = 6 * n * m;
}
cout << sum << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3708kb
input:
2 2
output:
24
result:
ok single line: '24'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
1000 1000
output:
6000000
result:
ok single line: '6000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
987 654
output:
3872988
result:
ok single line: '3872988'