题解:P13103 [GCJ 2019 Qualification] You Can Go Your Own Way
GeorgeDeng · · 题解
题目要求路径不能重合,为了保证路径不重合,我们尽量不要一致,所以我们把所有东西反过来输出即可。
注意
参考代码:
#include <iostream>
#define int long long
using namespace std;
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
int t;
cin>>t;
int cnt = 0;
while(t--){
cnt++;
cout<<"Case #"<<cnt<<": ";
int n;
string s;
cin>>n>>s;
n = 2*n-2;//注意
for(int i = 0;i<n;i++){
if(s[i]=='E') cout<<'S';//反过来输出即可
else cout<<'E';
}
cout<<endl;
}
return 0;
}