每次都尽量拿双方都为上的位置,再分类讨论

#include <bits/stdc++.h>
using namespace std;


int main()
{
    int n;
    cin>>n;
    string s1,s2;
    cin>>s1;
    cin>>s2;
    int cntu = 0;
    int cnt1 = 0;
    int cnt2 = 0;
    for(int i = 0;i<2*n;i++)
    {
        if(s1[i]=='U'&&s2[i]=='U')cntu++;
        if(s1[i]=='U'&&s2[i]=='D')cnt1++;
        if(s1[i]=='D'&&s2[i]=='U')cnt2++;
    }
    if(cntu%2==0){
        if(cnt1>cnt2)cout<<"clccle trl!"<<endl;
        if(cnt1==cnt2||cnt2-cnt1==1)cout<<"orz sarlendy!"<<endl;
        if(cnt2-cnt1>1)cout<<"sarlendy tql!"<<endl;
    }
    if(cntu%2==1){
        if(cnt1>cnt2||cnt1==cnt2)cout<<"clccle trl!"<<endl;
        if(cnt2-cnt1==1||cnt2-cnt1==2)cout<<"orz sarlendy!"<<endl;
        if(cnt2-cnt1>2)cout<<"sarlendy tql!"<<endl;
    }
    
    
    return 0;
}

全部评论

相关推荐

07-03 16:02
门头沟学院 Java
点赞 评论 收藏
分享
06-13 10:15
门头沟学院 Java
想去夏威夷的大西瓜在...:我也是27届,但是我现在研一下了啥项目都没有呀咋办,哎,简历不知道咋写
点赞 评论 收藏
分享
码农索隆:这种hr,建议全中国推广
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务