結果
| 問題 |
No.61 リベリオン
|
| コンテスト | |
| ユーザー |
kuuso1
|
| 提出日時 | 2014-11-10 01:20:33 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,034 bytes |
| コンパイル時間 | 1,156 ms |
| コンパイル使用メモリ | 113,484 KB |
| 実行使用メモリ | 49,312 KB |
| 最終ジャッジ日時 | 2024-12-31 09:17:35 |
| 合計ジャッジ時間 | 8,747 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 2 WA * 2 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections;
using System.Collections.Generic;
class TEST{
static void Main(){
Sol mySol =new Sol();
mySol.Solve();
}
}
class Sol{
public void Solve(){
for(int q=0;q<Q;q++){
Solve2(ria());
}
}
int Q;
public Sol(){
Q=ri();
}
void Solve2(int[] d){
int W,H,D,Mx,My,Hx,Hy,Vx,Vy;
W=d[0];H=d[1];D=d[2];
Mx=d[3];My=d[4];Hx=d[5];Hy=d[6];
Vx=d[7];Vy=d[8];
if(Vx<0){
Vx*=-1;
Mx=W-Mx;
Hx=W-Hx;
}
if(Vy<0){
Vy*=-1;
My=H-My;
Hy=H-Hy;
}
//Console.WriteLine("{0},{1} {2},{3}",Mx,My,Hx,Hy);
List<int> XX=new List<int>();
List<int> YY=new List<int>();
for(int i=0;i<H*W+1;i++){
for(int j=0;j<H*W+1;j++){
int x=j*W;
if(j%2==0)x+=Mx;
if(j%2!=0)x+=W-Mx;
int y=i*H;
if(i%2==0)y+=My;
if(i%2!=0)y+=H-My;
XX.Add(x);
YY.Add(y);
}
}
bool chk=false;
int C=XX.Count;
for(int i=0;i<C;i++){
//Console.WriteLine("{0} {1}:Hx={6},Hy={7}.Vx={2},Vy={3},diffX={4},diffY={5}",XX[i],YY[i],Vx,Vy,XX[i]-Hx,YY[i]-Hy,Hx,Hy);
if(Vx*(YY[i]-Hy)==Vy*(XX[i]-Hx)){
double T=Vx!=0?(double)(XX[i]-Hx)/(double)(Vx):(double)(YY[i]-Hy)/(double)(Vy);
if((double)D>=T){
chk=true;break;
}
}
}
Console.WriteLine(chk?"Hit":"Miss");
}
int LCM(int x,int y){
return x*y/GCD(x,y);
}
int GCD(int a,int b){
return a==0?b:GCD(b%a,b);
}
static String rs(){return Console.ReadLine();}
static int ri(){return int.Parse(Console.ReadLine());}
static long rl(){return long.Parse(Console.ReadLine());}
static double rd(){return double.Parse(Console.ReadLine());}
static String[] rsa(){return Console.ReadLine().Split(' ');}
static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}
kuuso1