結果

問題 No.61 リベリオン
ユーザー kuuso1kuuso1
提出日時 2014-11-10 00:52:01
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,812 bytes
コンパイル時間 2,353 ms
コンパイル使用メモリ 107,520 KB
実行使用メモリ 46,368 KB
最終ジャッジ日時 2023-08-30 02:58:44
合計ジャッジ時間 7,920 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
20,656 KB
testcase_01 AC 58 ms
20,620 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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;
		}
		
		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<W*H+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}:Vx={2},Vy={3},diffX={4},diffY={5}",XX[i],YY[i],Vx,Vy,XX[i]-Hx,YY[i]-Hy);
			if(Vx*(YY[i]-Hy)==Vy*(XX[i]-Hx)){
				double T=(double)(XX[i]-Hx)/(double)(Vx);
				if((double)D>T){
					chk=true;
				}
			}
		}
		
		Console.WriteLine(chk?"Hit":"Miss");
	
	}
	
	
	



	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));}
}
0