結果
問題 | No.84 悪の算盤 |
ユーザー |
![]() |
提出日時 | 2014-12-03 00:07:28 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 791 bytes |
コンパイル時間 | 582 ms |
コンパイル使用メモリ | 82,228 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 08:43:02 |
合計ジャッジ時間 | 1,144 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#include <algorithm> #include <climits> #include <cstdlib> #include <vector> #include <cctype> #include <deque> #include <cmath> #include <queue> #include <map> #include <set> #include <ctime> #include <stack> #include <cstdio> #include <string> #include <iomanip> #include <cstring> #include <iostream> #include <functional> using namespace std; typedef long long ll; #define LLMAX LLONG_MAX #define IMAX INT_MAX ll solve(ll r, ll c) { if (r != c) { if ((r*c)%2) { return r*(c/2)+(r+1)/2-1; }else { return (r*c)/2-1; } }else { if (r%2) { return 1+((r+1)/2)*((r+1)/2-1)-1; }else { return (r/2)*(r/2)-1; } } } int main() { ll r, c; cin >> r >> c; cout << solve(r, c) << endl; }