結果
| 問題 | No.131 マンハッタン距離 |
| コンテスト | |
| ユーザー |
akakimidori
|
| 提出日時 | 2017-06-09 01:32:59 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 394 bytes |
| 記録 | |
| コンパイル時間 | 117 ms |
| コンパイル使用メモリ | 20,352 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-22 13:38:20 |
| 合計ジャッジ時間 | 1,025 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 WA * 4 |
コンパイルメッセージ
main.c: In function ‘run’:
main.c:8:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%d%d%d",&x,&y,&d);
| ^~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
#define ABS(a) ((a)>=0?(a):-(a))
#define MIN(a,b) ((a)<(b)?(a):(b))
void run(void){
int x,y,d;
scanf("%d%d%d",&x,&y,&d);
int s=MIN(x,y);
int t=x+y-s;
if(d<=s){
printf("%d\n",d+1);
} else if(d<=t){
printf("%d",s+1);
} else if(d<=x+y){
printf("%d\n",d-(x+y)+1);
} else {
printf("0\n");
}
return;
}
int main(void){
run();
return 0;
}
akakimidori