求求了!最后一个WA呜呜呜
查看原帖
求求了!最后一个WA呜呜呜
591400
scott005577楼主2024/11/19 13:45
#include "iostream"

using namespace std;

int main(){
	
	int m , n;
	
	bool update;
	
	cin >> m >> n;
	
	int a[10000];
	
	int len = 0 , count = 0;
	
	len = m * n;
	
	for(int i = 0; i < (m * n) ; i ++){
		
		cin >> a[i];
		
		count += a[i];
		
	}
	
	if(len > 4){
		update = true;
	}else{
		update = false;
	}
	
	int errors = 0;
	
	if(update){

		for(int i = n + 1 ; i < (m * n - 1) - n ; i ++){
						
			for(int j = i ; j < i + (n - 2) ; j ++){
				
				errors += a[j];
				
			}
			
			i += n;
			
		}

		cout << count - errors;
	}else{
		
		int total = 0;
		
		for(int i = 0; i < m * n ; i ++){
			
			total += a[i];

		} 
		
		cout << total;
	}

	return 0;
	
}
2024/11/19 13:45
加载中...