結果
| 問題 |
No.131 マンハッタン距離
|
| コンテスト | |
| ユーザー |
haraduka_
|
| 提出日時 | 2015-01-23 19:03:29 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,201 bytes |
| コンパイル時間 | 703 ms |
| コンパイル使用メモリ | 88,336 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-23 00:57:17 |
| 合計ジャッジ時間 | 1,585 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 WA * 1 |
ソースコード
#include<iostream>
#include<string>
#include<map>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<bitset>
#include<functional>
#include<utility>
#include<iterator>
#include<algorithm>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<ctime>
#include<cstring>
#include<iomanip>
using namespace std;
#define len(val) static_cast<int>(val.size())
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
typedef pair<int, int> P;
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
int x, y, d;
cin >> x >> y >> d;
int res;
if(x > d){
if(y > d){
res = (d+1);
}else if(y == d){
res = (d-x+y+1);
}else{
res = (d-x+y+2);
}
}else if(x == d){
if(y > d){
res = (d+1);
}else if(y == d){
res = (d+1);
}else{
res = (y+1);
}
}else{
if(y > d){
res = (x+1);
}else if(y == d){
res = (d-y+x+1);
}else{
res = (x+y-d+1);
}
}
cout << (res < 0 ? 0 : res) << endl;
}
haraduka_