結果
問題 | No.131 マンハッタン距離 |
ユーザー |
![]() |
提出日時 | 2016-07-19 11:53:45 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 383 bytes |
コンパイル時間 | 409 ms |
コンパイル使用メモリ | 53,560 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-15 17:17:34 |
合計ジャッジ時間 | 1,397 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:27:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 27 | scanf("%d %d %d",&x,&y,&d); | ~~~~~^~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <iostream>#include <stdio.h>using namespace std;void f(int x,int y,int d){if(x+y<d){printf("0\n");return ;}if(x>y){int t=x;x=y;y=t;}if(d<=x){printf("%d\n",d+1);}else if(d<=y){printf("%d\n",x+1);}else{printf("%d\n",x+y-d+1);}}int main() {// your code goes hereint x,y,d;scanf("%d %d %d",&x,&y,&d);f(x,y,d);return 0;}