2 条题解

  • 0
    @ 2025-11-28 19:42:44

    贪心

    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n;
    	cin>>n;
    	string str;
    	vector<bool>day(n,0);
    	vector<bool>night(n,0);
    	string s1,s2;
    	cin>>s1>>s2;
    	int h=0;
    	for(int i=0;i<n;i++){
    		if(s1[i]=='N'&&s2[i]=='N')continue;
    		if(s1[i]=='Y'&&s2[i]=='N')h+=2;
    		if(s1[i]=='N'&&s2[i]=='Y')h+=2;
    		if(s1[i]=='Y'&&s2[i]=='Y')h+=3;
    	}
    	cout<<h;
    }
    

    信息

    ID
    136
    时间
    1000ms
    内存
    256MiB
    难度
    8
    标签
    递交数
    78
    已通过
    12
    上传者