C++ 编程练习:奥运奖牌统计 - 轻松实现奖牌数量计算
#include
int main() { int n; cin >> n;
int gold = 0, silver = 0, bronze = 0, total = 0;
for (int i = 0; i < n; i++) {
int g, s, b;
cin >> g >> s >> b;
gold += g;
silver += s;
bronze += b;
total += g + s + b;
}
cout << gold << " " << silver << " " << bronze << " " << total << endl;
return 0;
}
原文地址: https://www.cveoy.top/t/topic/p66k 著作权归作者所有。请勿转载和采集!