description stringlengths 35 9.39k | solution stringlengths 7 465k |
|---|---|
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | for i in range(int(input())):
n = int(input())
j = 2
a = []
while j*j < n:
if n % j == 0:
n //= j
a.append(j)
if len(a) == 2:
a.append(n)
break
j += 1
if len(a) < 3:
print('NO')
elif a[1] == a[2]:
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import sys
import time
import math
start_time = time.time()
input = sys.stdin.readline
t = int(input())
for _ in range( t):
n = int(input())
sqrtn = math.ceil(n**0.5)
a,b,c=1,1,1
mod = 2
while(True):
if n == 1 or mod > sqrtn:
break
if n % mod == 0 :
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | kl = int(input())
for l in range(kl):
pr = 0
n = int(input())
t = int(n ** 0.5)
a = []
for i in range(2, t + 1):
if n % i == 0:
a += [i]
n = n // i
if len(a) == 2:
pr = 1
break
if pr and a[1] < n:
print('YES')
print(... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... |
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args){
int t;
Scanner sc = new Scanner(System.in);
t = sc.nextInt();
for(int i=0;i<t;i++)
{
int n = sc.nextInt();
ArrayList<Integer> ans = new ArrayList<>();
int count=0;
int cube... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | t = int(input())
for _ in range(t):
n = int(input())
on = n
a = []
for i in range(2, 1+int(n**0.5)):
if not n%i:
a.append(i)
n//=i
if len(a) == 2:
break
if len(a) < 2 or on//(a[0]*a[1]) == 1 or on//(a[0]*a[1]) in a:
print... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
inline int mulmd(long long a, long long b) {
long long ret = (a * b) % 1000000007;
return (int)ret;
}
inline int power(long long x, long long y, int m) {
long long res = 1;
x = x % m;
while (y > 0) {
if (y & 1) {
res = mulmd(res, x);
}
y = y >> 1... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... |
import java.util.*;
public class C {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while (t-- > 0) {
int n = in.nextInt();
int a = 1, b = 1, c = 1;
for (int i = 2; i <= Math.sqrt(n); i++) {
if (n % i == 0) {
a = i;
break;
}
}... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | for _ in range(int(input())):
n = int(input())
f = 0
i = 2
li = []
while i*i<=n:
if n%i == 0:
f+=1
li.append(i)
n = n//i
i+=1
if f == 2:
break
if f==2 and n!=1 and n not in li:
print("YES")
print(*li, n)
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | from sys import stdin , stdout
from os import path
if path.exists("input.txt"):
stdin = open("input.txt",'r')
for _ in range(int(stdin.readline())):
x = int(stdin.readline())
i = 2
q = []
while len(q)< 2 and i*i < x:
if x%i == 0 :
q.append(i)
x //= i
i+=1
if len(q) == 2 and x not in q :
print("YES... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
def is_prime(n):
isPrime=1
for i in range(2,math.floor(math.sqrt(n))+1):
if n%i==0:
isPrime=1
break
if isPrime==1:
return False
return True
for _ in range(int(input())):
n=int(input())
isPrime = is_prime(n)
if isPrime:
print("... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... |
import java.util.ArrayList;
import java.util.Scanner;
public class ewtry {
public static void main(String[] args) {
Scanner sc=new Scanner (System.in);
int t=sc.nextInt();
while(t-->0)
{
int n=sc.nextInt();
ArrayList <Integer> l1=new ArrayList<Integer>();
for(int i... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | from math import ceil
def factorize(n):
ans = []
sq = ceil(n ** 0.5)
while n > 1 and len(ans) < 2:
prime = True
for i in range(2, sq + 1):
if n % i == 0:
if i not in ans:
ans.append(i)
n //= i
prime = F... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n, a, b, c, co = 0, te = 0;
cin >> n;
int x[3];
for (int j = 2; j <= sqrt(n); j++) {
if (n % j == 0) {
x[co++] = j;
n /= j;
te++;
if (te == 2) break;
}
}
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin >> t;
while (t--) {
long long int n, x, i, y;
cin >> n;
x = n;
vector<pair<long long int, int>> v;
for (i = 2; i * i <= x; i++) {
y = 0;
if (... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
for _ in range(int(input())):
n=int(input())
r=math.ceil(math.sqrt(n))+1
ou=[]
for i in range(2,r):
if len(ou)==2:
break
else:
if n%i==0:
n=n//i
ou.append(i)
if n>1 and len(ou)==2 and n not in ou:
print('YES'... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import sys
sys.setrecursionlimit(10**9)
IA =lambda: map(int,input().split())
ans=[0,0,0,0]
def solve(n):
num=int(0)
i=int(2)
tmp=1
m=n
while i*i<=m:
if n%i==0:
n=n//i
tmp*=i
if tmp not in ans:
num+=1
ans[num]=tmp
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cout.tie(NULL);
cout.tie(NULL);
;
long long tt;
cin >> tt;
while (tt--) {
long long n;
cin >> n;
long long a = -1;
for (long long i = 2; i * i <= n; i++) {
if (n % i == 0) {
a = i;
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | t = int(input())
for i in range(0,t):
n = int(input())
a = 1
j = 2
while((j*j) <= n):
if(n % j == 0):
a = j
break
j = j + 1
if(a == 1):
print("NO")
else:
b = 1
n = n / a
j = a + 1
while((j*j) <= n):
if(n ... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
def getFactors(n):
factors = []
while n%2==0:
factors.append(2)
n = n//2
k=3
while k <= math.sqrt(n):
if n%k==0:
n= n//k
factors.append(k)
else:
k+=2
if n>1:
factors.append(n)
return factors
t = in... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | t = int(input())
for _ in range(t) :
n = int(input())
i = 2
k = 1
x = 1
y = 1
z = 1
flag = 0
while i*i<=n :
if n%i==0 :
if k==1 :
x = i
n = n//i
k = 0
elif n//i != i and x!=i and x!= n//i:
y ... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | def solve(n):
a, b, c = None, None, None
for i in range(2, int(n**0.5) + 1):
if n%i == 0:
a = i
n = n/i
break
else:
return None
for i in range(a+1, int(n**0.5) + 1):
if n%i == 0:
b = i
c = int(n/i)
break
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | from math import sqrt
t = int(input())
f = ""
for _ in range(t):
n = int(input())
m = n
r = 0
x = []
for i in range(2, int(sqrt(n))+1):
if i>m or r==2:
break
else:
if m%i==0:
x.append(i)
m = m//i
r += 1
if r=... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
int d[1000001] = {0};
int sum[1000001] = {0};
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int a = -1, b = -1, c;
for (int i = 2; i <= sqrt(n); i++) {
if (n % i == 0 && a == -1) {
a = i;
} else if (a != -1 && (n / a)... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | from functools import reduce
import io
import os
import sys
from atexit import register
import random
import math
import itertools
##################################### Flags #####################################
# DEBUG = True
DEBUG = False
STRESSTEST = False
# STRESSTEST = True
############################... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... |
import java.io.*;
import java.math.*;
import java.util.*;
// @author : Dinosparton [ SHIVAM BHUVA ]
public class test {
static class Pair{
int x;
int y;
Pair(int x,int y){
this.x = x;
this.y = y;
}
}
static class Compare {
void compare... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | # ------------------- fast io --------------------
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not in file.mode... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import sys
I=sys.stdin.readline
ans=""
for _ in range(int(I())):
n=int(input())
fac=[]
for i in range(2,int(n**.5)):
if n%i==0:
fac.append((i,n//i))
break
if len(fac)!=0:
x=fac[0][1]
for i in range(2,int(x**.5)+1):
if x%i==0 and i!=fac[0][0]:
if i!=x//i:
ans+="YES\n"
ans+="{} {} {}\... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int main() {
ios_base::sync_with_stdio(false), cin.tie(0);
;
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int curr = n;
vector<int> ans;
bool ok = true;
while (ans.size() < 2 && ok) {
int currMax = (i... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | for i in range(int(input())):
n=int(input());c=0;x=[];y=n
for i in range(2,int(n**0.5)+1):
if y%i==0:
c+=1
y=y//i
x.append(i)
if c>=2:
break
print('YES' if c>=2 and y not in x else 'NO')
if c>=2 and y not in x:
print(*x[:2],... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | t=input()
for p in xrange(t):
n=input()
if n<20:
print "NO"
continue
i=2
k=n
fac=[]
d=0
while i*i<=n and d==0:
while k%i==0 and k!=0:
# print k
k=k/i
fac.append(i)
if len(fac)==3:
d=1
brea... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
public class ProductofThreeNumbers {
static boolean[] isPrime;
static ArrayList<Integer> primes;
static void sieve(... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | t = int(input())
for _ in range(t):
used = []
n = int(input())
for i in range(2,round(n/2)):
if i*i>=n: break
if n%i==0 and (i not in used):
used.append(i)
n=n/i
break
for i in range(2,round(n/2)):
if i*i>=n: break
if n%i==0 and (i not in used):
used.append(i)
n=n/i
break
if len(used) < 2... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const int INF = int(2e9) + 99;
void test_case() {
long long n;
cin >> n;
set<long long> st;
for (long long i = 2; i * i <= n; i++) {
if (n % i == 0 && st.find(i) == st.end()) {
st.insert(i);
n /= i;
break;
}
}
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | # maa chudaaye duniya
import math
def pf(n):
cat = []
while n%2 == 0:
cat.append(2)
n //= 2
for i in range(3, int(math.sqrt(n)) + 1, 2):
while n%i == 0:
cat.append(i)
n //= i
if n > 2:
cat.append(n)
return cat
for _ in range(int(input())):
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... |
t = int(input())
while t!=0:
n = int(input())
p = int(pow(n,.5))
a,b,c = -1,-1,-1
for i in range(2,p+1):
if n%i==0:
a= i
n = n//i
break
q = int(pow(n,.5))
for i in range(2,q+1):
if i!=a and n%i==0 and i!=n//i:
b=i
c=n... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | for _ in range(int(input())):
n=int(input())
s=set()
for i in range(2,int(pow(n,0.5))+1):
if(n%i==0):
s.add(i)
s.add(n//i)
l1=list(s)
n1=len(l1)
if(n1<3):
print("NO")
else:
flag=0
for i in range(n1-2):
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | //package CodeForces.RoadMap.D2_B;
import java.util.Arrays;
import java.util.Scanner;
/**
* @author Syed Ali.
* @createdAt 16/04/2021, Friday, 01:40
*/
public class ProductOfThreeNumsSolution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t=sc.nextInt();
int a[]=new int[3... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
int t, n;
int main() {
cin >> t;
while (t--) {
cin >> n;
int a[3] = {}, j = 0;
for (int i = 2; i * i < n && j < 2; i++) {
if (n % i == 0) a[j++] = i, n /= i;
}
if (j != 2)
cout << "NO\n";
else {
cout << "YES\n";
cout << a[... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | t = int(input())
for i in range(t):
n = int(input())
a=0
b=0
c=0
s=0
ss=0
nn=int(n**0.5)
for i in range(2,nn):
if n%i==0:
a=i
ss=50
break
if ss==0:
print('NO')
continue
ss=0
for i in range(a+1,nn):
if (n/a)%i... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | def solveOne(n):
ret = []
d = 2
while d * d < n and len(ret) < 3:
if n % d == 0:
ret.append(d)
n //= d
dd = 2
while dd * dd < n:
if n % dd == 0 and dd not in ret and n // dd not in ret:
ret.extend((dd, n // dd))
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | from sys import stdin, stdout
from collections import defaultdict
import math
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
def main():
cases = rll()
for line in stdin:
n = int(line)
ans = []
f1 = 2
while f1**2 <= n:
if n % f1 == 0:
ans.append(f1)
break
f1 += 1
if len(... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | t = int(input())
for _ in range(t):
n = int(input())
a, b, c = 0, 0, 0
i = 1
while i < n and i < 10 ** 4:
i += 1
if n % i == 0:
n = n // i
if a == 0:
a = i
elif b == 0:
b = i
c = n
break
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b);
long long nCr(long long n, long long r);
long long pow(long long b, long long n);
void read(long long a[], long long n);
void solve() {
long long n;
cin >> n;
vector<long long> v;
for (long long i = 2; i * i <= n; i++) {
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import java.io.*;
import java.util.*;
//import javafx.util.*;
import java.math.*;
//import java.lang.*;
public class Main
{
//static int n;
// static ArrayList<Integer> adj[];
// static boolean vis[];
// static long ans[];
static int arr[];
static long mod=1000000007;
stat... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | # cook your dish here
import math
t=int(input())
for _ in range(t):
count=0
a=[]
n=int(input())
for i in range(2,int(math.sqrt(n))):
if (n%i==0 and count<2):
n=int(n/i)
a.append(i)
count+=1
if n not in a and n!=1:
a.append(n)
count... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | def prime_decomposition(n):
i = 2
table = []
while i * i <= n:
while n % i == 0:
n /= i
table.append(i)
i += 1
if n > 1:
table.append(n)
return table
t = int(input())
for _ in range(t):
n = int(input())
ansl = []
pl = prime_decomposition(n... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
t=int(input())
for i in range(t):
n=int(input())
s=set()
for j in range(2,int(math.sqrt(n))+1):
if n%j==0 and not list(s).count(j):
s.add(j)
n/=j
break
for k in range(2,int(math.sqrt(n))+1):
if n%k==0 and not list(s).count(k):
s... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | for i in range(0,int(input())):
n=int(input())
f1=0
f2=0
root=int(n**0.5)
for i in range(2,root+1):
if n%i==0:
k=i
f1=1
break
if f1==1:
n=int(n/k)
root=int(n**0.5)
k1=k
for i in range(2,root+1):
if n%i==0 and... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | def smallestDivisor(start,n):
# if divisible by 2
if (n % 2 == 0 and start == 2):
return 2;
# iterate from 3 to sqrt(n)
i = start;
while(i * i <= n):
if (n % i == 0):
return i;
i += 1;
return n;
t = int(input())
for i in range(t):
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
def factors(n):
l = []
for i in range(2, int(math.sqrt(n))+1):
if n%i == 0:
l.append(i)
l.append(n//i)
return l
for _ in range(int(input())):
n = int(input())
l = factors(n)
nn = len(l)
flag = 0
for i in range(nn):
for j in range(nn):... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import sys
import math
t = int(sys.stdin.readline())
for _ in range(t):
n = int(sys.stdin.readline())
a = None
for i in range(2, int(math.sqrt(n))):
if n % i == 0:
a = i
break
if a == None:
print("NO")
continue
b = None
for j in range(2, int(math.... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
def printDivisors(n) :
i = 1
l=[]
while i <= math.sqrt(n):
if (n % i == 0) :
if (n / i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
i = i + 1
return l
t=int(input())
for _ in range(t):
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import sys
queries = int(sys.stdin.readline())
def numberToFactors(number,fromTop=False):
factor1 = number
factor2 = 2
if fromTop:
while factor2<=factor1**0.5:
factor2+=1
while factor2>2:
if factor1%factor2==0:
if fact... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | t = int(input())
while t > 0:
res = []
n = int(input())
root = int(n**.5)
while root > 1:
if n % root == 0:
rem = n/root
rem_root = int(rem**.5)
if rem == rem_root**2:
root -= 1
continue
else:
while r... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long>> arr;
vector<pair<long long, long long>> arr2;
vector<long long> dels;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
long long q;
cin >> q;
while (q--) {
long long n;
cin >> n;
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | for _ in range(int(input())):
num=int(input())
c=2
p=[]
while len(p)<2 and c*c<=num:
if num%c == 0:
num=num//c
p.append(c)
c+=1
if len(p)==2 and num not in p:
print("YES")
print(*p,num)
else:
print("NO") |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... |
import java.awt.Desktop;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.URI;
import java.net.URISyntaxException;
import java.sql.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | def primfacs(n):
i = 2
primfac = []
while i * i <= n:
while n % i == 0:
primfac.append(i)
n = n / i
i = i + 1
if n > 1:
primfac.append(n)
return primfac
def mul(arr):
p = 1
if not len(arr):
return 0
for i in arr:
p = p * i... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
from collections import Counter
t = int(input())
for _ in range(t):
n = int(input())
divisors = Counter()
for p in range(2, int(math.sqrt(n))+1):
while n % p == 0:
divisors[p] += 1
n //= p
if n > 1:
divisors[n] += 1
ans = [1, 1, 1, 1]
i = 1
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class pre372
{
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new Buffe... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
def ld(a, last):
found = False
for div in range(last,int(math.sqrt(a))+1):
if a % div == 0:
found = True
return div
if not found:
return False
def do(int):
x = ld(int,2)
if x:
y = ld(int//x, x+1)
if y:
z = int//(x*y)
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
for _ in range (int(input())):
n = int(input())
l = []
i = 2
while i < math.sqrt(n) and len(l) < 2:
if (n % i == 0):
l.append(i)
n = n // i
i = i + 1
if len(l) == 2 and n > l[1]:
print("YES")
print(*l, n)
else:
print("... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | from sys import stdin, stdout
fin = lambda: stdin.readline()
fout = lambda *args: stdout.write(' '.join(str(i) for i in args) + '\n')
def f(n, s=2):
a, b = -1, -1
for i in range(s, 22361):
if n % i == 0:
if a == -1:
a = i
n //= i
elif i < n // ... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | for _ in range(int(input())):
n = int(input())
fac = []
rem = 1
if n % 2 == 0:
n /= 2
fac.append(2)
tot = 1
tot *= 2
added = 2
x = 1
while n > 1 and n % 2 == 0:
x *= 2
n /= 2
tot *= 2
if fac[-1] < x:
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | t=int(input())
for q in range(t):
n=int(input())
lists=[]
i=2
while len(lists)<2 and i*i<n:
if n%i==0:
lists.append(i)
n//=i
i+=1
if len(lists)==2 and n not in lists:
print('YES')
print(*lists,n)
else:
print('NO') |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
template <typename T>
std::ostream &operator<<(std::ostream &out, vector<T> &v) {
for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
out << v[i] << " ";
out << "\n";
return out;
}
template <typename T>
std::ostream &operator<<(std::ostream &out, vector<p... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | t = int(input())
for _ in range(t):
n = int(input())
arr = [1] * 3
i = 0
p = 2
while n > 1:
if n % p != 0:
p += 1
if p >= int(n**0.5) + 1:
break
continue
arr[i] *= p
n //= p
if i > 0 and arr[1] == arr[0]:
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math,sys
from collections import Counter, defaultdict, deque
from sys import stdin, stdout
input = stdin.readline
lili=lambda:list(map(int,sys.stdin.readlines()))
li = lambda:list(map(int,input().split()))
#for deque append(),pop(),appendleft(),popleft(),count()
I=lambda:int(input())
S=lambda:input().strip()
mod... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | from functools import reduce
def factors(n):
l = []
for i in range(2,int(n**0.5)+1):
if n%i==0:
l.append(i)
l.append(n//i)
return l
for _ in range(int(input())):
n = int(input())
l = factors(n)
flag = False
flag1 = False
flag2 = False
for i in ra... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class PrimeFactorization {
private static List<Integer> primes = new ArrayList();
// Prepoulates the primes array with all prime numbers uptil N.
private static void prepopulatePrimes(int N) {
BitSet isP... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
using ll = long long int;
void solve() {
int n;
cin >> n;
if (n < 24) {
cout << "NO\n";
return;
}
set<int> div;
for (int i = 2; i * i <= n; ++i) {
if (n % i == 0 and !div.count(i)) {
div.insert(i);
n /= i;
break;
}
}
for (in... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const long long mod = 1e9 + 7;
const long long N = 2e5;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
long long t;
cin >> t;
;
while (t--) {
long long n;
cin >> n;
;
long long cpy = n;
map<long long... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... |
t = int(input())
def prime_decomposition(n):
table = []
for i in range(2, int(n ** 0.5) + 1):
while n % i == 0:
table += [i]
n //= i
if n == 1:
break
if n != 1:
table += [n]
return table
for i in range(t):
n = int(input())
s = prime_decomposition(n)
s.sort()
flg = 0
if len(s) < 3:
print ("NO"... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
t = int(input())
for _ in range(t):
n = int(input())
factors = []
for factor in range (2, int(math.sqrt(n))):
if n <= factor:
break
if n % factor == 0:
if n // factor <= factor:
break
factors.append(factor)
n = n //... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | t=int(input())
while(t):
l=set()
tr=0
n=int(input())
ce=n
if n>=12:
i=2
while(n>0 and tr<3 ):
if tr<2 and i*i>ce:
break
if tr==2:
l.add(int(n))
tr=tr+1
break
elif n%i... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | for _ in range(int(input())):
n=int(input())
l=[]
i=2
while i**2<=n and len(l)<2:
if n%i==0:
l.append(i)
n//=i
i+=1
if len(l)<2 or n==1 or l.count(n):
print("NO")
else:
print("YES")
l.append(n)
print(*l)
|
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | def s(a,b):
i = b+1
c = int(a**0.5)
while 1:
if a%i==0:
return i
else:
if i<c:
i+=1
else:
return 1
for _ in range(int(input())):
n = int(input())
a = s(n,1)
#print(a)
if a==1 or a==n:
print('NO')
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | // package Div3_615;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
public class ProblemC {
public static void main(String[] args)throws IOException {
BufferedReader br=new BufferedReader(new InputStreamRea... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | def SieveOfEratosthenes(n):
data=[]
prime = [True for i in range(n + 1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * 2, n + 1, p):
prime[i] = False
p += 1
prime[0]= False
prime[1]= False
for p in range(n + 1):
i... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | /* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
public static void main (String[] args)
{
// your code goes here
Scanner s=new Scanner(System.in);
int t=... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import java.io.*;
import java.util.*;
public class Main
{
public static void main(String[] args) throws Exception
{
Scanner sc = new Scanner(System.in) ;
PrintWriter out = new PrintWriter(System.out) ;
int t = sc.nextInt() ;
while(t-->0)
{
int [] factors = new int [32] ;
int id = 0 ;
int n ... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | from collections import Counter
def primes(n):
primfac = []
d = 2
while d*d <= n:
while (n % d) == 0:
primfac.append(d)
n //= d
d += 1
if n > 1:
primfac.append(n)
return primfac
for _ in range(int(input())):
n = int(input())
a = primes(n)
if(len(... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import sys
input = sys.stdin.readline
from collections import *
def factorize(n):
fct = []
for i in range(2, int(n**0.5)+1):
c = 0
while n%i==0:
n //= i
c += 1
if c>0:
fct.append((i, c))
if n>1:
fct.append((... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
# method to print the divisors
def printDivisors(n) :
# Note that this loop runs till square root
i = 2
l=[]
while i <= math.sqrt(n):
if (n % i == 0) :
# If divisors are equal, print only one
if (n / i == i) :
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | for tc in range(int(input())):
n=int(input())
a=[]
for i in range(2,int(n**0.5)+1):
if n%i==0:
a.append(i)
if n//i!=i:
a.append(n//i)
a.sort()
if len(a)<3:
print("NO")
else:
flag=0
for i in range(len(a)):
for j ... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | def solution():
temp = [True]*31623
for i in range(2, 31623):
if temp[i]:
for j in range(i+i, 31623, i):
temp[j] = False
er = [i for i, v in enumerate(temp) if v][2:]
for _ in range(int(input())):
n = int(input())
ans = set()
er_iter = er.__ite... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | from sys import stdin
import math
t=int(stdin.readline().rstrip())
while t>0:
n=int(stdin.readline().rstrip())
p=int(math.floor(math.sqrt(n)))
l=[]
a,b=-1,-1
for i in range(2,p+1):
if n%i==0:
a=i
n//=a
break
for i in range(2,p+1):
if n%i==0 and... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
srand(time(NULL));
;
int q;
cin >> q;
while (q--) {
long long n;
cin >> n;
vector<long long> ans;
for (long long i = 2; i <= sqrt(n); i++) {
if (n % i == 0) {
a... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 2 11:27:04 2020
@author: pc
"""
'''
times = int(input())
for _ in range(times):
testified_number = int(input())
able = 0
for factor in range(2,testified_number):
if testified_number % factor == 0:
testified_number_new = testified_number //... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | from bisect import *
from collections import *
from itertools import *
import functools
import sys
import math
from decimal import *
from copy import *
from heapq import *
from fractions import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 10**5+10
MOD = 10**9+7
spf = [i for i in range(MAXN)]
spf[0]=spf[1] = -1
def... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | # cook your dish here
from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left
from bisect import bisect_right
def L():
return list(map(int, stdin.readline().split()))
def In():
return map(int, stdin.readli... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... |
# Author : raj1307 - Raj Singh
# Date : 13.02.2020
from __future__ import division, print_function
import os,sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
from __builtin__ import xrange as range
from future_builtins import ascii, filter, hex, map, oct, zip
def ii(): return int(input())
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | t = int(input())
for i in range(t):
n = int(input())
#if n < 24:
# print('NO')
a = 0
b = 0
c = 0
sqrt = int(n ** 0.5)
for i in range(2, sqrt + 1):
if n % i == 0:
a = i
n /= a
break
if a:
for i in range(a +1, int(n ** 0.... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
def pd(n,not_include) :
li = []
for i in range(2, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n / i == i) :
if n!=not_include:
lis=[]
lis.append(i)
lis.append(i)
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | """
// Author : snape_here - Susanta Mukherjee
"""
from __future__ import division, print_function
import os,sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
from __builtin__ import xrange as range
from future_builtins import ascii, filter, hex, map, oct, zip
def ii(): return int(i... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | def Fenjie(n):
k = {}
if (n == 1):
return {}
a = 2
while (n >= 2):
b = n%a
if (a*a > n):
if (n in k):
k[n] += 1
else:
k[n] = 1
break
if (b == 0):
if (a in k):
k[a] += 1
... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... |
def fact(n):
i=2
for i in range(2,int(n**0.5)+1):
if n%i==0 and i not in l:
return i
return 0
for _ in range(int(input())):
l=[]
n=int(input())
a=fact(n)
l.append(a)
if a!=0:
b=fact(n/a)
else:
print("NO")
continue
if b!=0:
z=(n... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | for _ in range(int(input())):
n=int(input())
flag=0
for i in range(2,1001):
if(n%i==0):
a=i
n//=i
flag=1
break
#print(n)
if(flag==0):
print("NO")
else:
i=a+1
flag1=0
while(i*i<=n):
if(n%i=... |
You are given one integer number n. Find three distinct integers a, b, c such that 2 β€ a, b, c and a β
b β
c = n or say that it is impossible to do it.
If there are several answers, you can print any.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 100)... | import math
t = int(input())
while t > 0:
n = int(input())
fact = []
for i in range(2, int(math.sqrt(n))+1):
if i*int(n/i) == n:
if i != int(n/i):
fact.append(i)
fact.append(int(n/i))
else:
fact.append(i)
fact.sort()
fla... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.