Skip to content

Commit db02a9b

Browse files
authored
Create Robot Detector.java
1 parent 95a0671 commit db02a9b

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import java.util.*;
2+
import java.lang.*;
3+
import java.io.*;
4+
5+
class Codechef
6+
{
7+
static class FastReader
8+
{
9+
BufferedReader br;
10+
StringTokenizer st;
11+
12+
public FastReader()
13+
{
14+
br = new BufferedReader(new
15+
InputStreamReader(System.in));
16+
}
17+
18+
String next()
19+
{
20+
while (st == null || !st.hasMoreElements())
21+
{
22+
try
23+
{
24+
st = new StringTokenizer(br.readLine());
25+
}
26+
catch (IOException e)
27+
{
28+
e.printStackTrace();
29+
}
30+
}
31+
return st.nextToken();
32+
}
33+
34+
int nextInt()
35+
{
36+
return Integer.parseInt(next());
37+
}
38+
39+
long nextLong()
40+
{
41+
return Long.parseLong(next());
42+
}
43+
44+
double nextDouble()
45+
{
46+
return Double.parseDouble(next());
47+
}
48+
49+
String nextLine()
50+
{
51+
String str = "";
52+
try
53+
{
54+
str = br.readLine();
55+
}
56+
catch (IOException e)
57+
{
58+
e.printStackTrace();
59+
}
60+
return str;
61+
}
62+
}
63+
public static void main (String[] args) throws java.lang.Exception
64+
{
65+
// your code goes here
66+
FastReader sc=new FastReader();
67+
int x=sc.nextInt();
68+
int y=sc.nextInt();
69+
String s="U";
70+
for(int j=1;j<=x;j++) {
71+
if(j%2==0) {
72+
s=s+"D";
73+
for(int i=1;i<y;i++) {
74+
s=s+"L";
75+
}
76+
s=s+"U";
77+
78+
}
79+
else {
80+
if(j!=1){
81+
s=s+"D";
82+
}
83+
for(int i=1;i<y;i++) {
84+
s=s+"R";
85+
}
86+
if(j!=1){
87+
s=s+"U";
88+
}
89+
}
90+
}
91+
System.out.println(s);
92+
}
93+
}

0 commit comments

Comments
 (0)