結果

問題 No.48 ロボットの操縦
ユーザー uliba3
提出日時 2020-07-15 12:54:35
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 238 bytes
コンパイル時間 2,615 ms
コンパイル使用メモリ 190,496 KB
最終ジャッジ日時 2025-01-11 21:08:05
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:26: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     int X,Y,L,ans=0;scanf("%d %d %d",&X,&Y,&L);
      |                     ~~~~~^~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int X,Y,L,ans=0;scanf("%d %d %d",&X,&Y,&L);
    ans+=abs(X)/L;if(X%L>0)ans++;
    ans+=abs(Y)/L;if(Y%L>0)ans++;
    if(Y<0)ans+=2;else if(X!=0)ans++;
    printf("%d\n",ans);
}
0