QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#811259#9628. 骰子TosakaUCW#AC ✓0ms3704kbC++201.4kb2024-12-12 17:04:362024-12-12 17:04:37

Judging History

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

  • [2024-12-12 17:04:37]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3704kb
  • [2024-12-12 17:04:36]
  • 提交

answer

#include <bits/stdc++.h>
using i64 = long long;
#define int i64
#define pb push_back
#define ep emplace
#define eb emplace_back
using std::cerr;
// using namespace std::views;
// using namespace std::ranges;
using std::max, std::min, std::swap, std::array;
using std::cin, std::cout, std::string, std::vector;
using std::ostream;
template <class T1, class T2> ostream &operator<<(ostream &os, const std::pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << '\n'; }
using pii = std::pair<int, int>;
#define fi first
#define se second

void solve() {
    int n; cin >> n;
    int m; cin >> m;
    if (n >= 2 and m >= 2) {
        cout << n * m * 6LL << '\n';
        return;
    }
    if (n == 1) swap(n, m);
    int ans = 0;
    // 4 6 3 1
    int a[] = {0, 6, 9, 10};
    ans += n / 4 * 14;
    if (n % 4 != 0) ans += a[n % 4];
    cout << ans << '\n';
}

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    // for (int T = read(); T--; solve());
    solve();
    return 0;
}

詳細信息

Test #1:

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

input:

2 2

output:

24

result:

ok single line: '24'

Test #2:

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

input:

1000 1000

output:

6000000

result:

ok single line: '6000000'

Test #3:

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

input:

987 654

output:

3872988

result:

ok single line: '3872988'