結果
問題 | No.131 マンハッタン距離 |
ユーザー |
👑 |
提出日時 | 2021-11-13 15:28:57 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 287 bytes |
コンパイル時間 | 624 ms |
コンパイル使用メモリ | 62,592 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-27 11:51:54 |
合計ジャッジ時間 | 1,243 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include <iostream>using namespace std;int main(){int x,y,d;cin>>x>>y>>d;if(d < y){y = d;}if(d < x){x = d;}int ans = d+1;if(d > y){ans -= d-y;}if(d > x){ans -= d-x;}cout << max(0,ans) << endl;}