求调玄关 Wa #7 , #17
查看原帖
求调玄关 Wa #7 , #17
1024189
funeral楼主2024/10/19 20:35
#include<bits/stdc++.h>
#define int long long
using namespace std;

int n;
int a[1000005],b[15];
int c[1000005],sum;

signed main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		sum+=a[i];
		b[a[i]]++;
	}
	if(sum<=10){
		cout<<0;
		return 0;
	}
	int tot=0;
	for(int i=1;i<=10;i++){
		if(b[i]){
			if(b[i]==1){
				tot++;
				c[tot]=i;
			}
			if(b[i]>1&&b[i]<10){
				for(int j=tot+1;j<=tot+b[i];j++){
					c[j]=i;
				}
				tot+=b[i];
			}
			if(b[i]>=10){
				for(int j=tot+1;j<=tot+10;j++){
					c[j]=i;
				}
				tot+=10;
			}
		}
	}
	
	for(int i=1;i<tot;i++){
		for(int j=i+1;j<=tot;j++){
			if((sum-a[i]-a[j])%10==0){
				cout<<a[i]<<' '<<a[j]<<'\n';
				if((a[i]+a[j])%10==0)cout<<10;
				else cout<<(a[i]+a[j])%10;
				return 0;
			}
		}
	}
	cout<<0;
	
	return 0;
}
2024/10/19 20:35
加载中...