結果
| 問題 | No.131 マンハッタン距離 | 
| コンテスト | |
| ユーザー |  184 | 
| 提出日時 | 2015-01-21 00:08:54 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 358 bytes | 
| コンパイル時間 | 198 ms | 
| コンパイル使用メモリ | 34,688 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-22 23:26:15 | 
| 合計ジャッジ時間 | 1,012 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 20 WA * 4 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         int x,y,d;scanf("%d%d%d",&x,&y,&d);
      |                   ~~~~~^~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <cstdio>
#include <cstring>
#include <cstdlib> 
#include <algorithm>
 
using namespace std;
//namaega184
int main(){
	int x,y,d;scanf("%d%d%d",&x,&y,&d);
	
	if(x+y<d)printf("0\n");
	else if(x+y==d||d==0)printf("1\n");
	else{
		int ax=min(x,d),ay=min(y,d),bx=max(d,y-d),by=max(d,x-d);
		printf("%d\n",min(min(ax,ay),min(bx,by))+1);
	}
	return 0;
}
            
            
            
        