結果
| 問題 | No.61 リベリオン | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2017-01-20 16:23:48 | 
| 言語 | D (dmd 2.109.1) | 
| 結果 | 
                                RE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 905 bytes | 
| コンパイル時間 | 629 ms | 
| コンパイル使用メモリ | 109,424 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-12 06:31:18 | 
| 合計ジャッジ時間 | 1,343 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 2 RE * 2 | 
コンパイルメッセージ
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/numeric.d(2999): Warning: cannot inline function `std.numeric.gcdImpl!uint.gcdImpl`
ソースコード
import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.math;      // math functions
import std.numeric;   // gcd
void main()
{
  auto q = readln.chomp.to!size_t;
  foreach (_1; q.iota) {
    auto rd = readln.split.to!(int[]);
    auto w = rd[0], h = rd[1], d = rd[2], mx = rd[3], my = rd[4];
    auto hx = rd[5], hy = rd[6], vx = rd[7], vy = rd[8];
    auto g = gcd(vx.abs, vy.abs), ux = vx / g, uy = vy / g;
    auto w2 = w * 2, h2 = h * 2;
    auto fij = new bool[][](h2, w2);
    auto bx = hx, by = hy;
    foreach (_2; (d * g).iota) {
      bx += ux;
      bx = (bx < 0 ? bx + w2 : bx) % w2;
      by += uy;
      by = (by < 0 ? by + h2 : by) % h2;
      if (fij[by][bx]) break;
      fij[by][bx] = true;
    }
    auto rx = w2 - mx, ry = h2 - my;
    if (fij[my][mx] || fij[my][rx] || fij[ry][mx] || fij[ry][rx])
      writeln("Hit");
    else
      writeln("Miss");
  }
}
            
            
            
        