結果

問題 No.84 悪の算盤
ユーザー ty70
提出日時 2015-06-15 15:33:40
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,501 bytes
コンパイル時間 778 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-13 08:53:27
合計ジャッジ時間 1,241 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm> // require sort next_permutation count __gcd reverse etc.
#include <cstdlib> // require abs exit atof atoi
#include <cstdio> // require scanf printf
#include <functional>
#include <numeric> // require accumulate
#include <cmath> // require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip> // require setw
#include <sstream> // require stringstream
#include <cstring> // require memset
#include <cctype> // require tolower, toupper
#include <fstream> // require freopen
#include <ctime> // require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
/*
No.84
R != C res = (R*C+1)/2 - 1
R == C
R == 1 res = 1 - 1
R == 2 res = 1 - 1
R == 3 res = 3 - 1
R == 4 res = 4 - 1
R == 5 res = 7 - 1
R == 6 res = 9 - 1
R == 7 res = 13 - 1
R == 8 res = 16 - 1
R == 9 res = 21 - 1
res = (R*C + 3 )/4 - 1
*/
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int main()
{
ios_base::sync_with_stdio(0);
ll R, C; cin >> R >> C;
ll res;
if (R != C ){
res = (R*C + 1LL )/2LL - 1LL;
}else{ // if (R == C )
res = (R*C + 3LL )/4LL - 1LL;
} // end if
cout << res << endl;
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0