結果
| 問題 | 
                            No.48 ロボットの操縦
                             | 
                    
| コンテスト | |
| ユーザー | 
                             hayakawa4739
                         | 
                    
| 提出日時 | 2018-06-25 14:51:28 | 
| 言語 | C  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 387 bytes | 
| コンパイル時間 | 132 ms | 
| コンパイル使用メモリ | 29,184 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-06-30 22:38:34 | 
| 合計ジャッジ時間 | 1,076 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 18 WA * 7 | 
コンパイルメッセージ
main.c: In function 'main':
main.c:11:12: warning: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   11 |         if(abs(y) % dis == 0){
      |            ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    2 | #include<math.h>
  +++ |+#include <stdlib.h>
    3 | 
            
            ソースコード
#include<stdio.h>
#include<math.h>
int main(void){
	int x,y,dis;
	int count = 0;
	scanf("%d %d %d",&x,&y,&dis);
	if(abs(y) % dis == 0){
		count += abs(y)/dis;
	}else{
		count += abs(y)/dis + 1;
	}
	if(x != 0){
		count++;
	}
	if(abs(x) % dis == 0){
		count += abs(x)/dis;
	}else{
		count += abs(x)/dis + 1;
	}
	printf("%d\n",count);
	return 0;
}
            
            
            
        
            
hayakawa4739