c++求助
查看原帖
c++求助
741120
_O__o_楼主2022/8/26 10:51
#include<bits/stdc++.h>

using namespace std;
int ch[100]; //语文の分数 
int sh[100]; //数学の分数 
int en[100]; //外语の分数 
int main() {
	int n;//正整数n
	cin >> n ;
	int sum;//对数 
	for(int a=0;a <= n;a++){//for循环实现输入 
		cin >> ch[a] >> sh[a] >> en[a];
		
	}
	for(int a;a <= n;a++) {
		for(int y,s,w,c,e;;e++){
			y = abs(ch[e]-ch[e+1]);
			s = abs(sh[e]-sh[e+1]);
			w = abs(en[e]-en[e+1]);
			c = y + s + w;
			if(y < 5 && s < 5 && w < 5 && c < 10){
				sum += 1;
			}
		}
	}
	cout << sum;


	return 0;
}


2022/8/26 10:51
加载中...