題目鏈接
題意:6個數字,一個取兩個,妹子取三個,問最後誰會贏
思路:排個序,判斷前兩個和3 - 5個的和誰更大即可
代碼:
#include#include #include #include using namespace std; int t, a[6]; int main() { scanf("%d", &t); while (t--) { for (int i = 0; i < 6; i++) scanf("%d", &a[i]); sort(a, a + 6); int aa = a[5] + a[4]; int bb = a[3] + a[2] + a[1]; if (aa > bb) printf("Grandpa Shawn is the Winner!\n"); else printf("What a sad story!\n"); } return 0; }