結果
| 問題 |
No.48 ロボットの操縦
|
| コンテスト | |
| ユーザー |
hayakawa4739
|
| 提出日時 | 2018-06-25 14:53:30 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 441 bytes |
| コンパイル時間 | 145 ms |
| コンパイル使用メモリ | 29,824 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-30 22:38:38 |
| 合計ジャッジ時間 | 922 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 WA * 24 |
コンパイルメッセージ
main.c: In function 'main':
main.c:17:12: warning: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
17 | 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(x == 0 && y < 0){
count += 2;
}else if(x == 0 && y >= 0){
count++;
}
if(abs(y) % dis == 0){
count += abs(y)/dis;
}else{
count += abs(y)/dis + 1;
}
if(abs(x) % dis == 0){
count += abs(x)/dis;
}else{
count += abs(x)/dis + 1;
}
printf("%d\n",count);
return 0;
}
hayakawa4739