0
已采纳
张睿杰
初级天翼
初级天翼
struct basketball
{
int three;
int two;
int penalty;
};
basketball a[10001];
定义 n,sf,lf,ff,zf;
int main()
{
输入n
for (int i=1; i<=n; i++)
{
输入a[i].three a[i].two a[i].penalty;
sf+=a[i].three;lf+=a[i].two;ff+=a[i].penalty;
}
zf=sf*3+lf*2+ff*1;
最后输出sf lf ff zf
0
王子轩
新手光能
新手光能
for(int i=1;i<=n;i++) { cin>>a>>b>>c; f+=a; j+=b; h+=c; } cout<<f<<" "<<j<<" "<<h<<" "<<f*3+j*2+h;
核心代码
0
0
张月柔
初级守护
初级守护
struct basketball
2
{
3
int three;
4
int two;
5
int penalty;
6
};
7
basketball a[10001];
8
定义 n,sf,lf,ff,zf;
9
int main()
10
{
11
输入n
12
for (int i=1; i<=n; i++)
13
{
14
输入a[i].three a[i].two a[i].penalty;
15
sf+=a[i].three;lf+=a[i].two;ff+=a[i].penalty;
16
}
17
zf=sf*3+lf*2+ff*1;
18
最后输出sf lf ff zf
0
时梓繁
修练者
修练者
int a,b,c,n,i,t=0,san=0,er=0,fa=0; cin>>n; for(i=1;i<=n;i++){ cin>>a>>b>>c; san=san+a; er=er+b; fa=fa+c; } t=san*3+er*2+fa; cout<<san<<" "<<er<<" "<<fa<<" "<<t; return 0; }
0