結果
| 問題 | No.131 マンハッタン距離 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-02-28 22:24:25 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2,407 ms / 5,000 ms |
| コード長 | 433 bytes |
| 記録 | |
| コンパイル時間 | 634 ms |
| コンパイル使用メモリ | 54,432 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-12 00:34:40 |
| 合計ジャッジ時間 | 14,965 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
#include <iostream>
using namespace std;
/*
(0,0),(x,0),(0,y),(x,y)
->
マンハッタン距離 → |x1-x2|+|y1-y2| = d
*/
int x,y,d;
bool RectCheck(int px,int py){
if(px > x || py > y) return false;
else return true;
}
int main(){
cin >> x >> y >> d;
int ans = 0;
for(int X = 0; X <= d; X++){
if(RectCheck(X,d-X) ==true){
ans++;
}
}
cout << ans << endl;
return 0;
}