PTA 乙级 1046 划拳 (15分) C/C++
水水水
C/C++
1 #include<iostream> 2 3 using namespace std; 4 5 int main() { 6 int n = 0; 7 /*甲喝 乙喝*/ 8 int ad = 0, bd = 0; 9 /*甲喊 甲划 乙喊 乙划*/ 10 int acall = 0, ahand = 0, bcall = 0, bhand = 0; 11 cin >> n; 12 for (int i = 0; i < n; ++i) { 13 cin >> acall >> ahand >> bcall >> bhand; 14 if (ahand == bhand) continue; //划得一样(平局) 15 else if (ahand == (acall + bcall)) bd++; //甲赢乙喝 16 else if (bhand == (acall + bcall)) ad++; //乙赢甲喝 17 } 18 cout << ad << ' ' << bd; 19 return 0; 20 }
默默地一点点变强,细节决定成败