結果
| 問題 | 
                            No.208 王将
                             | 
                    
| コンテスト | |
| ユーザー | 
                             TLwiegehtt
                         | 
                    
| 提出日時 | 2015-07-12 01:44:23 | 
| 言語 | C90  (gcc 12.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 514 bytes | 
| コンパイル時間 | 696 ms | 
| コンパイル使用メモリ | 20,736 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-08 05:48:27 | 
| 合計ジャッジ時間 | 1,101 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 15 WA * 8 | 
コンパイルメッセージ
main.c: In function ‘main’:
main.c:26:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   26 |         scanf("%d %d", &tx, &ty);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
main.c:27:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   27 |         scanf("%d %d", &ex, &ey);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <stdio.h>
int abs(int n){
	if(n<0){
		return -1*n;
	}
	return n;
}
int getSymbol(int n){
	if(n<0){
		return -1;
	}else if(n>0){
		return 1;
	}else{
		return 0;
	}
}
int main(void){
	int ex, ey;
	int tx, ty;
	int dis;
	
	
	scanf("%d %d", &tx, &ty);
	scanf("%d %d", &ex, &ey);
	
	if(abs(tx) > abs(ty)){
		dis = abs(tx);
	}else{
		dis = abs(ty);
	}
	
	if(getSymbol(ex) == getSymbol(tx) && getSymbol(ey) == getSymbol(ty)){
		if(abs(tx) > abs(ex)){
			dis += 1;
		}
	}
	
	printf("%d\n", dis);
	
	return 0;
}
            
            
            
        
            
TLwiegehtt