解题思路: 用不用枚举类型均可!
注意事项:
参考代码:
#include<bits/stdc++.h> //使用枚举 using namespace std; int main(){ enum caiquan{shitou, bu, jiandao}; int a, b; cin >> a >> b; if(a == jiandao && b == bu || a == bu && b == shitou || a == shitou &&b == jiandao) cout<<"1"<<endl; else if(a == b) cout << "0" << endl; else cout << "-1" << endl; return 0; }
#include<bits/stdc++.h> //不使用枚举 using namespace std; int main(){ //enum caiquan{shitou, bu, jiandao}; int a, b; cin >> a >> b; if(a == 2 && b == 1 || a == 1 && b == 0 || a == 0 &&b == 2) cout<< "1" <<endl; else if(a == b) cout << "0" << endl; else cout << "-1" << endl; return 0; }
0.0分
3 人评分