結果

問題 No.540 格子点と経路
ユーザー kurenai3110
提出日時 2017-07-01 00:15:32
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 460 bytes
コンパイル時間 593 ms
コンパイル使用メモリ 70,812 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-04 22:09:35
合計ジャッジ時間 1,522 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 8 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <unordered_map>
#include <map>
#include <queue>
#include <cstdlib>
using namespace std;

int main()
{
	int W, H; cin >> W >> H;

	int m = min(W, H);
	int M = max(W, H);
	
	int cost = 0;
	int x = 3;
	for (int i = 1; i <= m; i++) {
		cost += x;
		if (i % 2 == 0)x += 4;
	}


	for (int i = 0; i < M-m; i++)cost += m + m%2;

	cout << cost+(M>m && m%2==0) << endl;
	
	return 0;
}
0