【题目描述】
2008年北京奥运会,A国的运动员参与了n天的决赛项目(1 ≤ n ≤ 17)。现在要统计一下A国所获得的金、银、铜牌数目及总奖牌数。输入第1行是A国参与决赛项目的天数n,其后n行,每一行是该国某一天获得的金、银、铜牌数目。输出4个整数,为A国所获得的金、银、铜牌总数及总奖牌数。带我去看题目
【输入】
输入n+1行,第1行是A国参与决赛项目的天数n,其后n行,每一行是该国某一天获得的金、银、铜牌数目,以一个空格分开。
【输出】
输出1行,包括4个整数,为A国所获得的金、银、铜牌总数及总奖牌数,以一个空格分开。
【输入样例】
3 1 0 3 3 1 0 0 3 0
【输出样例】
4 4 3 11
【通过代码】
#include <bits/stdc++.h> using namespace std; int n,a,b,c,at,bt,ct; int main(){scanf("%d",&n);for(int _i = 1;_i <= n;_i ++){scanf("%d%d%d",&a,&b,&c);at += a;bt += b;ct += c;}printf("%d %d %d %d",at,bt,ct,at+bt+ct);return 0; }
详细解决方案
1064:奥运奖牌计数
热度:78 发布时间:2024-02-05 15:45:35.0
相关解决方案
- 急 MySQL Error# 1064,该如何处理
- mysql error code:1064 求一下
- mysql error 1064
- 急 MySQL Error# 1064,该如何处理
- with SQL state '42000', error code '1064'
- 1064. 朋友数(20) PAT
- XTU OJ 1064 输入输出
- PAT (Basic Level) Practice 1064 朋友数
- ERROR 1064 (42000):You have an error in your SQL syntax; check the manual that corresponds to your M
- Mysql库名中包含-等特殊符号报错:ERROR 1064 (42000): You have an error in your SQL syntax
- mysql创建表时报错rr] 1064 - You have an error in your SQL syntax; check the manual that corresponds to you
- POJ---1064(Cable master,简单二分判断可行性)
- ZZULIOJ 1064: 加密字符
- 1064:奥运奖牌计数
- mysql 命令 show databases 出错“ERROR 1064 (42000): You have an error in your SQL syntax”