题目链接
大意:让你输出走k步的方案.
思路:按如下方式构造即可.

注意合并相同的方案
细节见代码:

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
int n,m,k;
int main() {
  ios::sync_with_stdio(false);
  cin>>n>>m>>k;
  if(k>4*n*m-2*n-2*m)cout<<"NO\n";
  else{
    vector<pair<int,string>>v,ans;
    for(int i=1;i<=n;i++){
      for(int j=2;j<=m;j++){
        if(n>1&&i!=n){
          v.pb(mp(1,"RDU"));
          continue;
        }
        v.pb(mp(1,"R"));
        if(n>1&&i!=n)v.pb(mp(1,"D")),v.pb(mp(1,"U"));
      }
      if(m>1)v.pb(mp(m-1,"L"));
      if(i<n)v.pb(mp(1,"D"));
    }
    if(n>1)v.pb(mp(n-1,"U"));
    for(auto x:v){
      if(!k)break;
     // cout<<k<<endl;
      if(k>x.fi*(x.se.size())){
        k-=x.fi*(x.se.size());
        if(x.fi){
          if(!ans.empty()&&ans.back().se==x.se){
            auto &y=ans.back();
            y.fi+=x.fi;
            continue;
          }
          ans.pb(x);
        }
 
      }else{
        if(k/x.se.size())ans.pb({k/x.se.size(),x.se});
        if(k%x.se.size())ans.pb(mp(1,x.se.substr(0,k%x.se.size())));
        break;
      }
    }
    //cout<<k<<endl;
    cout<<"YES\n";
    cout<<ans.size()<<'\n';
    for(auto x:ans)cout<<x.fi<<' '<<x.se<<'\n';
  }
  return 0;
}