题目链接:http://codeforces.com/gym/101981/attachments
n和m太小,空地联通无环,总步数太大,直接随机输出5w个方向
#include<iostream> #include<algorithm> #include<ctime> using namespace std; int t,a,b,c,d,k; int main() { srand((unsigned)time(0)); int n,m; char op,ch[4]={‘L‘,‘R‘,‘U‘,‘D‘}; cin>>n>>m; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) cin>>op; } for(int i=1;i<=50000;i++) { cout<<ch[rand()%4]; } cout<<endl; return 0; }
原文地址:https://www.cnblogs.com/chen99/p/11707561.html
时间: 2024-11-02 14:04:17