10分求救!!WA#1 AC#2 其余TLE
查看原帖
10分求救!!WA#1 AC#2 其余TLE
736027
zhouchenrui楼主2024/11/2 12:11
#include<bits/stdc++.h>
using namespace std;
int a[10]={6,2,5,5,4,5,6,3,7,6};
int main(){
	int n;cin>>n;				
	while(n--){
		int t;
		cin>>t;
		if(t<2){
			cout<<"-1"; 
		}else{
			for(int i=1;;i++){
				int cnt=0;
				int y=i;
				while(y>0){
					cnt+=a[y%10];
					y/=10;
				}
				if(cnt==t){
					cout<<i<<endl;
					break;
				}
			}
		}
		
	}
	return 0;
}
2024/11/2 12:11
加载中...