3167:【例28.1】 统计奖牌(C、C++、python)

3167:【例28.1】 统计奖牌

信息学奥赛一本通-编程启蒙(C++版)在线评测系统

28.1_哔哩哔哩_bilibili



C语言代码:

#include <stdio.h>
#include <stdlib.h>
int main( void )
{
	int a,b,c,i,n,sum01=0,sum02=0,sum03=0;
	
	scanf("%d",&n);
	
	for(i=1;i<=n;i++)
	{
		scanf("%d%d%d",&a,&b,&c);
		sum01+=a;
		sum02+=b;
		sum03+=c;
	}
	
	printf("%d %d %d %d",sum01,sum02,sum03,sum01+sum02+sum03);
	
	return 0;
}



C++代码:

/*
1064:奥运奖牌计数
http://ybt.ssoier.cn:8088/problem_show.php?pid=1064
*/
#include<iostream>
using namespace std;
 
int main()
{
	
	int n,jp=0,yp=0,tp=0;
	
	cin>>n;
	
	for (int i=1,x,y,z; i<=n; i++)
    {
		cin>>x>>y>>z;

		jp += x;
		yp += y;
		tp += z;
	}
	
	cout<<jp<<" "<<yp<<" "<<tp<<" "<<jp+yp+tp<<endl;
	
	return 0;
}


#include<iostream>
using namespace std;
int a[20][20],n,p[4];
int main()
{
	cin>>n;

	for(int i=1;i<=n;i++)
    {
		for(int j=1;j<=3;j++)
        {
			cin>>a[i][j];
			p[j]+=a[i][j];
		}
	}

	cout<<p[1]<<" "<<p[2]<<" "<<p[3]<<" "<<p[1]+p[2]+p[3];
	
    return 0;
}


python3代码:

"""
1.5编程基础之循环控制 07 奥运奖牌计数
http://noi.openjudge.cn/ch0105/07/

https://blog.csdn.net/weixin_45852964/article/details/103199313
https://blog.csdn.net/weixin_45852964/article/details/103375233
https://blog.csdn.net/weixin_45852964/article/details/103586946
https://blog.csdn.net/weixin_45852964/article/details/103481658

"""
n = int(input())
x,y,z=[0,0,0]

for i in range(n):
    a,b,c=list(map(int,input().split()))
    x+=a
    y+=b
    z+=c

print("{} {} {} {}" .format(x,y,z,x+y+z))


n=int(input())

gold,silver,bronze=0,0,0

for _ in range(n):
    x,y,z=input().split()
    gold+=int(x)
    silver+=int(y)
    bronze+=int(z)

print(gold,silver,bronze,gold+silver+bronze)



 




C++信息学奥赛题目归类:初赛普及组阅读程序写结果题

C++信息学奥赛题目归类:初赛普及组阅读程序写结果题_#include <iostream> using namespace std; int n, m;-CSDN博客

【初赛】「阅读程序」题答v1.0

【初赛】「阅读程序」题答v1.0_阅读程序题怎么做-CSDN博客



【用脚趾头解决NOIP】(1):NOIP2010~NOIP2015普及组问题求解

【用脚趾头解决NOIP】(1):NOIP2010~NOIP2015普及组问题求解_把m个同样的球放到n个同样的袋子里,允许有的袋子空着不放,问共有多少种不同的放置-CSDN博客

【用脚趾头解决NOIP】(2)NOIP2009~NOIP2015年普及组完善程序

【用脚趾头解决NOIP】(2)NOIP2009~NOIP2015年普及组完善程序_最大连续子段和 noip 2009-CSDN博客

C++信息学奥赛题目归类:初赛普及组阅读程序写结果题

C++信息学奥赛题目归类:初赛普及组阅读程序写结果题_#include <iostream> using namespace std; int n, m;-CSDN博客



FBZ串问题 NOIP1998

https://www.cnblogs.com/myeln/articles/16580782.html

NOIP2017初赛_提高组_阅读程序写结果3.2

NOIP2017初赛_提高组_阅读程序写结果3.2_2017 noip 初赛 阅读程序-CSDN博客

NOIP初赛_阅读与理解程序

NOIP初赛_阅读与理解程序_noip比赛程序阅读-CSDN博客

C++基础 二维数组之蛇形矩阵、蛇形填数、神奇的幻方等

C++基础 二维数组之蛇形矩阵、蛇形填数、神奇的幻方等_c++二维数组实现蛇形矩阵-CSDN博客

  • 7
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dllglvzhenfeng

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值