0分求助
查看原帖
0分求助
416242
New_hope楼主2023/7/13 08:27
#include<bits/stdc++.h>
#define L 1000005
using namespace std;

long long mod[10];
int main(){
	
	long long n,i,j,sum,ans;
	cin >> n;
	for(i=1;i<=n;i++){
		long long temp;
		scanf("%lld",&temp);
		mod[temp%10]++;
		sum += temp;
	}
	ans = sum%10;
	for(i=0;i<10;i++){
		for(j=0;j<10;j++){
			if(i == j && mod[i]<2) continue; 
			if(mod[j] && mod[i]){
				if((i+j)%10 == ans){
					if(ans == 0) cout << 10;
					else printf("%lld",ans);
					return 0;
				}
			}
		}
	}
	cout << 0;
	return 0; 
}
2023/7/13 08:27
加载中...