結果

問題 No.331 CodeRunnerでやれ
ユーザー 37zigen37zigen
提出日時 2016-05-28 13:22:08
言語 Java21
(openjdk 21)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 834 bytes
コンパイル時間 2,929 ms
コンパイル使用メモリ 73,740 KB
実行使用メモリ 134,548 KB
最終ジャッジ日時 2023-09-23 23:59:28
合計ジャッジ時間 15,084 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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=15;int y=15;
		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++;
						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][x]=-1;
				}
			}
		}
	}
}
0