Croc Champ 2013 Round 2 (Div. 2 Edition) C. Weird Game

很悲剧的一提,重提交的了三次,WA 6,第6测试用例是
4
10001001
10101101
输出:Draw

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main(){
    long n;
    cin >>n;
    string s,t;
    cin >> s>>t;
    long ones=0,onet =0,oneshare = 0;
    for(long i =0; i < 2*n; i ++){
        if(s[i]=='1' && t[i]!='1') ones++;
        if(s[i]!='1' && t[i]=='1') onet++;
        if(s[i]=='1' && t[i] =='1') oneshare++;
    }
    if(oneshare%2 == 0){
        if(ones > onet) cout<<"First"<<endl;
        else if(ones < onet-1) cout<<"Second"<<endl;
        else cout<<"Draw"<<endl;
    }
    else{
        if(ones>= onet) cout<<"First"<<endl;
        else if(onet == ones +1 || onet == ones+2) cout<<"Draw"<<endl;
        else cout<<"Second"<<endl;
    }
    return 0;
}

  

原文地址:https://www.cnblogs.com/xiongqiangcs/p/3037001.html