#include #include #include #include using namespace std; using namespace atcoder; using namespace __gnu_pbds; using mint = modint998244353; #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define print(var) std::cout<<#var<<"="<<(var)< #define vvi vector #define vvvi vector #define ll long long #define vll vector #define vvll vector #define vvvll vector #define vvvvll vector #define vmi vector #define vvmi vector #define vvvmi vector #define vvvvmi vector #define vvvvvmi vector #define vs vector #define pii pair #define vpii vector #define vvpii vector #define bit(x,i)(((x)>>(i))&1) #define inf (1<<30) #define INF (1ll<<60) #define X first #define Y second template inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); } template inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); } template T nibutan(T ok, T ng, const F &f){while(abs(ok-ng)>1){T mid = (ok+ng)/2;(f(mid)?ok:ng) = mid;}return ok;} template vector digit(T x){vector res; while(x>0){res.push_back(x%10); x/=10;} return res;} ostream& operator<<(ostream& os, const mint& x){ os << x.val(); return os; } template istream &operator>>(istream &is, vector &vec){ for(auto &v:vec) is >> v; return is; } template void coutvector(vector x){ for(int i=0;i<(int)x.size();i++){if(i>0) cout<<" ";cout<, rb_tree_tag, tree_order_statistics_node_update>; template using Unordered_Map = gp_hash_table; #ifdef LOCAL #include CPP_DUMP_DEFINE_EXPORT_OBJECT(mint,val()); #else #define cpp_dump #endif inline double get_time() { #ifdef ONLINE_JUDGE timeval tv; gettimeofday(&tv, NULL); return tv.tv_sec * 1e3 + tv.tv_usec * 1e-3; #else using namespace std::chrono; return duration_cast(system_clock::now().time_since_epoch()).count(); #endif } double start_time = get_time(); inline double elapsed(){ return get_time() - start_time; } static uint32_t xor128(void){ static uint32_t x=123456789,y=362436069,z=521288629,w=88675123; uint32_t t; t=(x^(x<<11));x=y;y=z;z=w; return( w=(w^(w>>19))^(t^(t>>8)) ); } inline int randrange(int a){return (uint64_t(xor128()) * a >> 32); } inline int randrange(int a, int b){ return randrange(b-a)+a; } inline double randDouble(double a,double b){return a+(b-a)*xor128()/(double)ULONG_MAX;} const int H = 20, W = 20; int P; enum Dir{ U,D,L,R }; vpii around{{0,1},{1,0},{-1,0},{0,-1}}; vector route2dir(const vpii &route){ vector res; for(int i=1;i<(int)route.size();i++){ if(route[i-1].X==route[i].X){ if(route[i-1].Y+1==route[i].Y) res.push_back(R); else if(route[i-1].Y-1==route[i].Y) res.push_back(L); else assert(false); } else if(route[i-1].Y==route[i].Y){ if(route[i-1].X+1==route[i].X) res.push_back(D); else if(route[i-1].X-1==route[i].X) res.push_back(U); else assert(false); } else assert(false); } return res; } using Cost = double; #define INF_COST (1e100) using Edge = pair; using Graph = vector>; // 頂点 start からダイクストラ法使って各頂点までの最短路長を求める std::vector dijkstra(const Graph& graph, int start) { std::vector dist(graph.size(), INF_COST); dist[start] = 0; std::priority_queue, vector>, greater>> pque; pque.emplace(0, start); while (!pque.empty()) { auto [now_cost, now] = pque.top(); pque.pop(); if (dist[now] < now_cost) continue; for (auto [to, cost] : graph[now]) { if (chmin(dist[to], now_cost + cost)) { pque.emplace(now_cost + cost, to); } } } return dist; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int hoge1,hoge2; cin>>hoge1>>hoge2; cin >> P; double init_no_wall_prob = 1 - (double)150/760; vector> h(H-1,vector(W,init_no_wall_prob)); vector> v(H,vector(W-1,init_no_wall_prob)); auto update_no_wall_prob = [&](double &nw){ nw = nw/(nw + (double)100/P*(1-nw)); return; }; while(true){ // h,vの-logを使ってdijkstraをする vector>> graph(H*W); auto to_idx = [&](int x, int y){ return x*W+y; }; auto to_pos = [&](int idx){ return make_pair(idx/W,idx%W); }; for(int i=0;i> route; int now = H*W-1; vector> visited(H,vector(W,false)); visited[to_pos(now).X][to_pos(now).Y] = true; while(now!=0){ route.push_back(to_pos(now)); int mn_to = -1; double mn_cost = INF_COST; for(auto [to,cost]:graph[now]){ if(visited[to_pos(to).X][to_pos(to).Y]) continue; if(chmin(mn_cost,cost+dist[to])){ mn_to = to; } } assert(mn_to!=-1); now = mn_to; visited[to_pos(now).X][to_pos(now).Y] = true; } route.push_back(to_pos(0)); reverse(all(route)); // 経路出力 auto dir = route2dir(route); string outstr; for(auto d:dir){ if(d==U) outstr.push_back('U'); else if(d==D) outstr.push_back('D'); else if(d==L) outstr.push_back('L'); else if(d==R) outstr.push_back('R'); else assert(false); } cout << outstr << endl; // 結果の受け取り int cnt; cin >> cnt; if(cnt==-1) exit(0); // 通れたところは壁じゃない for(int i=0;i