結果
問題 |
No.331 CodeRunnerでやれ
|
ユーザー |
|
提出日時 | 2016-05-28 13:25:43 |
言語 | Java (openjdk 23) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 874 bytes |
コンパイル時間 | 2,254 ms |
コンパイル使用メモリ | 77,404 KB |
実行使用メモリ | 133,272 KB |
最終ジャッジ日時 | 2024-07-16 23:50:36 |
合計ジャッジ時間 | 15,101 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 1 |
other | TLE * 1 -- * 15 |
ソースコード
package yukicoder; import java.util.Scanner; public class Main{ public static void main(String[] args){ new Main().solve(); } void solve(){ Scanner sc=new Scanner(System.in); //F,B,L,R String s=""; int[][] map=new int[50][50]; int x=25;int y=25; int[] dx={1,0,-1,0}; int[] dy={0,1,0,-1}; int d=0; while(true){ boolean f=false; if(map[y][x]!=0){ for(int i=1;i<=3;i++){ if(map[y+dy[(d+i)%4]][x+dx[(d+i)%4]]==0){ System.out.println("R"); f=true; d++; s=sc.nextLine(); break; } } } if(f=true)continue; else if(!f){ System.out.println("F"); s=sc.nextLine(); if(s.equals("Merry Christmas!"))return; else if(Integer.parseInt(s)>0){ x=x+dx[d%4]; y=y+dy[d%4]; map[y][x]=1; }else if(Integer.parseInt(s)==0){ map[y+dy[d%4]][x+dx[d%4]]=-1; } } } } }