結果
問題 |
No.131 マンハッタン距離
|
ユーザー |
|
提出日時 | 2015-09-22 14:01:49 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 526 bytes |
コンパイル時間 | 445 ms |
コンパイル使用メモリ | 59,332 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-19 08:37:10 |
合計ジャッジ時間 | 1,250 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 WA * 4 |
ソースコード
#include <iostream> using namespace std; #include <cstdio> #include <string.h> #include <stdlib.h> #include <math.h> #define REP(i,a,b) for(i=a;i<b;i++) #define rep(i,n) REP(i,0,n) typedef long long ll; typedef unsigned long long ull; typedef long double lb; /* ここからが本編 */ int main(void) { int i,j,k; int x,y,d; long ans; cin >> x >> y >> d; if(x < y) swap(x,y); if(d > x + y) ans = 0; else if(x >= d && y >= d ) ans = d + 1; else ans = 1+x-d+y; cout << ans << endl; return 0; }