水题求hack
查看原帖
水题求hack
380639
dthythxth_Huge_Brain楼主2024/2/27 09:04
#include<bits/stdc++.h>
#define int long long
namespace FAST_IO{
	using std::sort;
	const int LEN=1<<18;
	char BUF[LEN],PUF[LEN];
	int Pin=LEN,Pout;
	inline void flushin(){memcpy(BUF,BUF+Pin,LEN-Pin),fread(BUF+LEN-Pin,1,Pin,stdin),Pin=0;return;}
	inline void flushout(){fwrite(PUF,1,Pout,stdout),Pout=0;return;}
	inline char Getc(){return (Pin==LEN?(fread(BUF,1,LEN,stdin),Pin=0):0),BUF[Pin++];}
	inline char Get(){return BUF[Pin++];}
	inline void Putc(char x){if(Pout==LEN)flushout(),Pout=0;PUF[Pout++]=x;}
	inline void Put(char x){PUF[Pout++]=x;}
	template<typename tp=int>inline void swap(tp x,tp y){if(x!=y)x^=y^=x^=y;}
	template<typename tp=int>inline tp max(tp a,tp b){return a>b?a:b;}
	template<typename tp=int>inline tp abs(tp a){return a>0?a:-a;}
	template<typename tp=int>inline tp qpow(tp a,tp b,tp mod){if(b==0)return 1;int tmp=qpow(a,b>>1,mod);if(b&1)return tmp*a%mod*tmp%mod;return tmp*tmp%mod;}
	template<typename tp=int>inline tp min(tp a,tp b){return a>b?b:a;}
	template<typename tp=int>inline tp gcd(tp a,tp b){while(b^=a^=b^=a%=b);return a;}
	template<typename tp=int>inline tp read(){(Pin+32>=LEN)?flushin():void();tp res=0;char f=1,ch=' ';for(;ch<'0'||ch>'9';ch=Get())if(ch=='-')f=-1;for(;ch>='0'&&ch<='9';ch=Get())res=(res<<3)+(res<<1)+ch-48;return res*f;}
	template<typename tp>inline void wt(tp a){if(a>9)wt(a/10);Put(a%10+'0');return;}
	template<typename tp>inline void write(tp a,char b=' '){static int stk[20],top;(Pout+32>=LEN)?flushout():void();if(a<0)Put('-'),a=-a;else if(a==0)Put('0');for(top=0;a;a/=10)stk[++top]=a%10;for(;top;--top)Put(stk[top]^48);if(b!='\0')Put(b);return;}
}
using namespace FAST_IO;
int t=1,n,pos,ss[10],vis[10000005];
void solve(){
	//¶à²â²»Çå¿Õ£¬±¬ÁãÁ½ÐÐÀᣡ
	n=read(),pos=0,memset(ss,0,sizeof ss);
	if(n==1)return Put('1');
	if(!n)return Put('1'),Put('0');
	for(int i=9;i>1;i--)while(n%i==0)n/=i,ss[i]++;
	if(n!=1)return(void)Put('-'),Put('1');
	for(int i=2;i<=9;i++)for(int j=1;j<=ss[i];j++)write(i,'\0');
	Put('\n');
}
signed main(){
	t=read();
	for(;t--;)solve();
	flushout();
	return 0;
}

2024/2/27 09:04
加载中...