我自己是没有找到规律的,但是这种题放在第二题,要么暴力要么有规律,因此我们可以先对前几十个数暴力打表,然后就找到规律了,其证明如下,感谢Layton
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <math.h>
#include <cstdio>
#include <string>
#include <bitset>
#include <cstring>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <unordered_map>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define ins insert
#define lowbit(x) (x&(-x))
#define mkp(x,y) make_pair(x,y)
#define mem(a,x) memset(a,x,sizeof a);
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> P;
const double eps=1e-8;
const double pi=acos(-1.0);
const int inf=0x3f3f3f3f;
const ll INF=1e18;
const int Mod=1e9+7;
const int maxn=2e5+10;
int gcd(int a,int b){
return b==0?a:gcd(b,a%b);
}
int lcm(int a,int b){
return a/gcd(a,b)*b;
}
void solve(int x,int &ansx,int &ansy){
int ans=inf;
for(int i=1;i<x;i++){
int j=x-i;
if(lcm(i,j)<ans){
ans=lcm(i,j);
ansx=min(i,j);
ansy=max(i,j);
}
}
}
void table(){
for(int i=2;i<=50;i++){
int x,y;
solve(i,x,y);
cout<<i<<"---"<<x<<" "<<y<<endl;
}
}
int main(){
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int t,n;
cin>>t;
while(t--){
cin>>n;
int ans=1;
for(int i=2;i*i<=n;i++)
if(n%i==0){
int j=n/i;
ans=max(ans,max(i,j));
}
cout<<ans<<" "<<n-ans<<endl;
}
return 0;
}