PROBLEM LINK:
Author: Leo Lee
Tester: Daanish Mahajan
Editorialist: Leo Lee
DIFFICULTY:
Cakewalk
PREREQUISITES:
Math
PROBLEM:
There are T testcases. For each testcase, you are given an integer N. Find two integers A and B such that A * B = N.
Subtask 1 [100 points]: 1 \le T \le 10^5, 1 \le N \le 10^9
QUICK EXPLANATION:
A = 1, B = N.
EXPLANATION:
Subtask 1:
We can use the property that every number times 1 is itself. That means we can always set one number as 1, making the other number N.
SOLUTIONS:
Setter's Solution
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
cout << "1 " << n << endl;
}
}
Tester's Solution
import java.util.*;
import java.io.*;
public class Main{
static PrintWriter out;
static InputReader in;
public static void main(String args[]){
out = new PrintWriter(System.out);
in = new InputReader();
new Main();
out.flush(); out.close();
}
Main(){
solve();
}
void solve(){
int t = in.nextInt();
while(t-- > 0){
int n = in.nextInt();
out.println(1 + " " + n);
}
}
public static class InputReader{
BufferedReader br;
StringTokenizer st;
InputReader(){
br = new BufferedReader(new InputStreamReader(System.in));
}
public int nextInt(){
return Integer.parseInt(next());
}
public long nextLong(){
return Long.parseLong(next());
}
public double nextDouble(){
return Double.parseDouble(next());
}
public String next(){
while(st == null || !st.hasMoreTokens()){
try{
st = new StringTokenizer(br.readLine());
}catch(IOException e){}
}
return st.nextToken();
}
}
}