結果

問題 No.540 格子点と経路
ユーザー 👑 kmjpkmjp
提出日時 2017-07-01 00:01:24
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,138 bytes
コンパイル時間 1,571 ms
コンパイル使用メモリ 160,524 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-15 07:17:02
合計ジャッジ時間 5,046 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 2 ms
6,940 KB
testcase_15 WA -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 WA -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int W,H;


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>H>>W;
	
	if(H%2==0 && W%2==1 && H>W) {
		cout<<(2*H)*((W+1)/2)+1<<endl;
	}
	else if(H%2==1 && W%2==0 && W>H) {
		cout<<(2*W)*((H+1)/2)+1<<endl;
	}
	/*
	if(H%2==0 && W%2==0) {
		if(H>W) swap(H,W);
		cout<<H*(W+1)+1<<endl;
	}
	else if(H%2==0 && W%2==1) {
		assert(0);
		cout<<(2*H)*((W+1)/2)+1<<endl;
	}
	else if(H%2==1 && W%2==0) {
		assert(0);
		cout<<(2*W)*((H+1)/2)+1<<endl;
	}
	*/
	else {
		assert(0);
	}
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}
0