第一、二样例是啥???
查看原帖
第一、二样例是啥???
983841
Pluto_Dream_Sky楼主2024/10/27 13:46
#include<bits/stdc++.h>
using namespace std;
void solve(int n){
	if(n<2){
		cout<<-1<<'\n';
		return;
	}
	if(n==3){
		cout<<7<<'\n';
		return;
	}
	if(n==10){
		cout<<22<<'\n';
		return;
	}
	if(!(n%7)) while(n-7>=0){
		n-=7;
		cout<<8;
	}
	if(n%7==1){
		cout<<10;
		n-=8;
		while(n-7>=0) {
			n-=7;
			cout<<8;
		}
	}
	if(n%7==2){
		cout<<1;
		while(n-7>=0) {
			n-=7;
			cout<<8;
		}
	}
	if(n%7==3){
		cout<<200;
		n-=17;
		while(n-7>=0) {
			n-=7;
			cout<<8;
		}
	}
	if(n%7==4){
		cout<<20;
		n-=11;
		while(n-7>=0) {
			n-=7;
			cout<<8;
		}
	}
	if(n%7==5){
		cout<<2;
		while(n-7>=0) {
			n-=7;
			cout<<8;
		}
	}
	if(n%7==6){
		cout<<6;
		while(n-7>=0) {
			n-=7;
			cout<<8;
		}
	}
	cout<<'\n';
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t,n;
	cin>>t;
	while(t--){
		cin>>n;
		solve(n);
	}
	return 0;
}

一二样例总是过不去,本蒟蒻求调

2024/10/27 13:46
加载中...