L1-044. 稳赢

这种题不是考思维,就是考你细心程度还有基础知识的,代码如下:

#include <iostream>
#include <string> 

using namespace std;  

int main() {
    int  k;
    cin >> k;
    string temp;
    cin >> temp;
    int i = 0;
    while (temp != "End") {
        if (i == k) {
            i = -1;
            cout << temp << endl;
        } else if (temp == "ChuiZi") {
            cout << "Bu" << endl;
        } else if (temp == "JianDao") {
            cout << "ChuiZi" << endl;
        } else if (temp == "Bu"){
            cout << "JianDao" << endl;
        }
        cin >> temp;
        i++;
    }
    return 0;  
}  
原文地址:https://www.cnblogs.com/nr1999/p/8603949.html