🍔 注意这种比较大小1方法
🍔如果有多个数据可以用数组来存(my上一篇优化的博客里面有写)
#include <iostream> #include <cstring> #include <algorithm> using namespace std; int main() { int s[3] = {0}; int n; cin >> n; for (int i = 0; i < n; i ++ ) { int x; cin >> x; s[i % 3] += x; } int k = 0; for (int i = 1; i < 3; i ++ ) if (s[i] > s[k]) k = i; if (k == 0) puts("chest"); else if (k == 1) puts("biceps"); else puts("back"); return 0; }