結果

問題 No.131 マンハッタン距離
ユーザー startcpp
提出日時 2015-02-23 14:13:28
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 323 bytes
コンパイル時間 508 ms
コンパイル使用メモリ 55,772 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-23 21:55:38
合計ジャッジ時間 1,246 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

//直角二等辺三角形が見えた
#include<iostream>
using namespace std;

int x, y, d;

int main() {
	cin >> x >> y >> d;
	if ( x < y )
		swap(x, y);
	
	if ( d <= y ) {
		cout << max(0, d+1) << endl;
	}
	else if ( d <= x ) {
		cout << max(0, y+1) << endl;
	}
	else {
		cout << max(0, x+y-d+1) << endl;
	}
	return 0;
}
0