結果
| 問題 | 
                            No.48 ロボットの操縦
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2016-03-26 23:37:18 | 
| 言語 | D  (dmd 2.109.1)  | 
                    
| 結果 | 
                             
                                CE
                                 
                             
                            
                            (最新)
                                AC
                                 
                             
                            (最初)
                            
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 339 bytes | 
| コンパイル時間 | 436 ms | 
| コンパイル使用メモリ | 115,324 KB | 
| 最終ジャッジ日時 | 2024-11-14 19:36:06 | 
| 合計ジャッジ時間 | 862 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
            
            
            
            
            ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
Main.d(13): Error: `core.math.fabs` called with argument types `(int)` matches both: /home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/core/math.d(153): `core.math.fabs(float x)` and: /home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/core/math.d(155): `core.math.fabs(real x)` Main.d(14): Error: `core.math.fabs` called with argument types `(int)` matches both: /home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/core/math.d(153): `core.math.fabs(float x)` and: /home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/core/math.d(155): `core.math.fabs(real x)`
ソースコード
import std.stdio;
import std.conv;
import core.math;
int numRotations(int x, int y) {
    return (y < 0) ? 2 : ((0 == x) ? 0 : 1);
}
void main() {
    int x, y, l;
    readf("%s\n%s\n%s\n", &x, &y, &l);
    int nx = (to!int(fabs(x)) + l - 1) / l;
    int ny = (to!int(fabs(y)) + l - 1) / l;
    writeln(nx + ny + numRotations(x, y));
}