結果
問題 |
No.48 ロボットの操縦
|
ユーザー |
![]() |
提出日時 | 2016-05-30 20:40:34 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 385 bytes |
コンパイル時間 | 288 ms |
コンパイル使用メモリ | 24,192 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-07 19:30:50 |
合計ジャッジ時間 | 1,034 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 WA * 7 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:9:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%ld",&x); | ~~~~~^~~~~~~~~~ main.cpp:10:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%ld",&y); | ~~~~~^~~~~~~~~~ main.cpp:11:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%ld",&l); | ~~~~~^~~~~~~~~~
ソースコード
#include<stdio.h> #include<stdlib.h> int main(void){ long int x,y,l; long int n=0; scanf("%ld",&x); scanf("%ld",&y); scanf("%ld",&l); if(x < 0){ n++; } if( x != 0){ n += (abs(x)-(abs(x)%l))/l; n += (x%l)?1:0; } if(y < 0){ n+=2; } if(y != 0){ n += (abs(y)-(abs(y)%l))/l; n += (y%l)?1:0; } printf("%ld\n",n); return 0; }