結果

問題 No.131 マンハッタン距離
ユーザー dnish
提出日時 2017-07-05 01:35:21
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 228 bytes
コンパイル時間 1,718 ms
コンパイル使用メモリ 166,320 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-05 16:25:26
合計ジャッジ時間 2,269 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define p(s) cout<<(s)<<endl
using namespace std;

int main(){
	int x,y,d;
	cin>>x>>y>>d;
	int ans;
	if(x+y<d) ans=0;
	else if(x>=d&&y>=d) ans=d+1;
	else ans=min(d,x)+1-max(d-y,0);

	p(ans);
	return 0;
}
0