結果
問題 | No.61 リベリオン |
ユーザー | kuuso1 |
提出日時 | 2014-11-10 01:20:33 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,034 bytes |
コンパイル時間 | 2,353 ms |
コンパイル使用メモリ | 106,204 KB |
実行使用メモリ | 48,356 KB |
最終ジャッジ日時 | 2023-08-30 02:59:32 |
合計ジャッジ時間 | 9,807 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 58 ms
18,624 KB |
testcase_01 | AC | 58 ms
18,696 KB |
testcase_02 | AC | 59 ms
20,824 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 56 ms
20,696 KB |
コンパイルメッセージ
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));} }