結果
問題 | No.131 マンハッタン距離 |
ユーザー |
![]() |
提出日時 | 2016-03-21 02:49:27 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 762 bytes |
コンパイル時間 | 589 ms |
コンパイル使用メモリ | 83,180 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-01 12:12:14 |
合計ジャッジ時間 | 1,486 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
/* -*- coding: utf-8 -*-** 131.cc: No.131 マンハッタン距離 - yukicoder*/#include<cstdio>#include<cstdlib>#include<cstring>#include<cmath>#include<iostream>#include<string>#include<vector>#include<map>#include<set>#include<stack>#include<list>#include<queue>#include<deque>#include<algorithm>#include<numeric>#include<utility>#include<complex>#include<functional>using namespace std;/* constant *//* typedef *//* global variables *//* subroutines *//* main */int main() {int x, y, d;cin >> x >> y >> d;int minxy = min(x, y);int maxxy = max(x, y);int ans;if (d < minxy) ans = d + 1;else if (d > maxxy) ans = max(x + y - d + 1, 0);else ans = minxy + 1;printf("%d\n", ans);return 0;}