結果
問題 |
No.455 冬の大三角
|
ユーザー |
![]() |
提出日時 | 2016-12-06 04:15:31 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,153 bytes |
コンパイル時間 | 2,115 ms |
コンパイル使用メモリ | 79,140 KB |
実行使用メモリ | 41,924 KB |
最終ジャッジ日時 | 2024-11-28 00:00:20 |
合計ジャッジ時間 | 10,840 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 54 |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int H = sc.nextInt(); int W = sc.nextInt(); String [] S = new String [H]; int [] x = new int [3]; int [] y = new int [3]; int n=0; for(int i=0; i<H; i++){ S[i]=sc.nextLine(); for(int j=0; j<W; j++){ if(S[i].charAt(j)=='*'){ x[n]=j; y[n]=i; n++; } } } while(true){ int dx1 = x[1]-x[0]; int dy1 = y[1]-y[0]; int dx2 = x[2]-x[0]; int dy2 = y[2]-y[0]; int a = dx1*dx2+dy1*dy2; int b = dx1*dx1+dy1*dy1; int c = dx2*dx2+dy2*dy2; if(a*a!=b*c){ break; } x[2]=(int)(Math.random()*W); y[2]=(int)(Math.random()*H); } S[y[2]]=S[y[2]].substring(0,x[2])+"*"+S[y[2]].substring(x[2]+1); for(int i=0; i<H; i++){ System.out.println(S[i]); } } }