結果
| 問題 |
No.84 悪の算盤
|
| コンテスト | |
| ユーザー |
m1025o1184t
|
| 提出日時 | 2020-01-03 20:31:19 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 604 bytes |
| コンパイル時間 | 1,705 ms |
| コンパイル使用メモリ | 165,372 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-22 19:25:16 |
| 合計ジャッジ時間 | 2,328 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int r, c;
cin >> r >> c;
if (r != c) {
if (r % 2 != 0 && c % 2 != 0) {
ll ans = ((ll)r * c - 1) / 2ll + 1ll;
dunk(ans - 1);
}
else {
ll ans = ((ll)r * c) / 2;
dunk(ans - 1);
}
}
else {
if (r % 2 != 0) {
ll ans = ((ll)r * c - 1) / 4 + 1;
dunk(ans - 1);
}
else {
ll ans = ((ll)r * c) / 4;
dunk(ans - 1);
}
}
return 0;
}
m1025o1184t