QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#742501#9628. 骰子HaijieTanAC ✓0ms3660kbC++232.1kb2024-11-13 16:43:292024-11-13 16:43:30

Judging History

你现在查看的是最新测评结果

  • [2024-11-13 16:43:30]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3660kb
  • [2024-11-13 16:43:29]
  • 提交

answer

#include<iostream>
#include<vector>
#include<bitset>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
#include<numeric>//iota -- iota(all(a), x) a从头到尾从x开始递增
#include<cstring>
#include<ctime>
#include<array>
#include<list>
#include<random>
#include<tuple>
#include<deque>
#include<map>
#include<stack>
#include<set>
using namespace std;
#define IOS ios::sync_with_stdio(false);cin.tie(0), cout.tie(0)
#define int long long
#define all(x) x.begin(), x.end()
#define pb push_back
#define pf push_front
#define lowbit(x) (x & (-x))
const int xy[][2] = { 0,1, 0, -1, 1, 0, -1, 0 };
#define mem(a, x) memset(a, x, sizeof a)
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
typedef pair<char, char> PCC;
typedef pair<int, char> PIC;
typedef pair<char, int> PCI;
#define x first
#define y second
#define NO cout << "NO\n"
#define YES cout << "YES\n"
inline int read();
const int INF = 1e9, N = 1e4 + 10, MOD = 998244353, M = 1e4 + 10, K = 131;
const double PI = acos(-1.0);
void solve() {
    int n, m; cin >> n >> m;
    if (n == 1 || m == 1) {
        if (n == 1 && m == 1)cout << "6\n";
        else {
            int ret = 0;
            if (n == 1) {
                ret = m / 4 * 14;
                if (m % 4 == 1)ret += 6;
                else if (m % 4 == 2)ret += 9;
                else if (m % 4 == 3)ret += 10;
            }
            else {
                ret = n / 4 * 14;
                if (n % 4 == 1)ret += 6;
                else if (n % 4 == 2)ret += 8;
                else if (n % 4 == 3)ret += 9;
            }
            cout << ret << endl;
        }
    }
    else cout << n * m * 6 << endl;
}
signed main() {
    IOS;
    int _ = 1;
    //cin >> _;
    while (_--)solve();
    return 0;
}
inline int read()
{
    int x = 0, f = 1; char ch = getchar();
    while (ch < '0' || ch>'9') { if (ch == '-') f = -1; ch = getchar(); }
    while (ch >= '0' && ch <= '9') { x = x * 10 + ch - 48; ch = getchar(); }
    return x * f;
}
/*   /\_/\
*   (= ._.)
*   / >  \>
*/

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3628kb

input:

2 2

output:

24

result:

ok single line: '24'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

1000 1000

output:

6000000

result:

ok single line: '6000000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

987 654

output:

3872988

result:

ok single line: '3872988'