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)... | from math import ceil, sqrt
T = int(input())
answer = ""
for t in range(T):
n = int(input())
end = False
add = []
lim = ceil(sqrt(n)) + 1
for a in range(2, lim):
if n % a == 0:
for b in range(a+1, lim):
c = n / a / b
if int(c) == c and c !=... |
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
n = int(input())
for _ in range(n):
a = 0
b = 0
k = int(input())
for i in range(2,int(sqrt(k))+1):
if k%i == 0:
a = i
break
if a > 0:
temp = int(sqrt(k/a+1))
for i in range(a+1,temp+1):
if (k/a) % i == 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 check(count,n):
a = int(math.sqrt(n))
for i in range(count, a+1):
if n % i == 0:
return i
return 0
for i in range(int(input())):
n = int(input())
a,b,c = 0, 0 , 0
while(n != 0):
if (check(2,n) == 0):
c = n
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)... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(), cout.tie(NULL);
int t;
cin >> t;
while (t--) {
long long n, i, j, k, a = 1, b = 1, c = 1;
cin >> n;
bool ok = 1;
for (i = 2; i * i <= n; i++) {
if (n % i == 0) {
a = i;
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 math
for _ in range(int(input())):
n = int(input())
d = {}
x = int(math.sqrt(n))
ans = []
flag = 0
product = 1
for i in range(2,x+1):
if n%i==0:
product*=i
if n%product==0:
ans.append(i)
else:
product/=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)... | d=dict()
import math
def primeFactors(n):
c=0
while n % 2 == 0:
c+=1
n = n // 2
if c!=0:
d[2]=c
for i in range(3, int(math.sqrt(n)) + 1, 2):
c=0
while n % i == 0:
c+=1
n = n // i
if c!=0:
d[i]=c
if n > 2:
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)... | for j in range(int(input())):
n=int(input())
flag = False
for i in range(2,int(n**(1/3))+1):
if n%i==0:
z=n//i
for k in range(i+1,int(z**0.5)+1):
if z%k==0 and k*k!=z:
flag=True
print("YES")
print(i,k... |
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())
if t<=100:
while t>0:
l=list()
n = int(input())
x = int(2)
y = int(2)
z = int(2)
for i in range(2,round(n**0.5)+1):
if n%i == 0 and not(i in l):
n=n//i
l.append(i)
break
for i in range(... |
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 primeFactors(n):
a = []
while n % 2 == 0:
a.append(2)
n = n // 2
for i in range(3,int(math.sqrt(n))+1,2):
while n % i== 0:
a.append(i)
n = n//i
if n > 2:
a.append(n)
return a
t = int(input())
for _ in range(t):
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
from math import sqrt
def primeFactors(n):
a=[]
# Print the number of two's that divide n
while n % 2 == 0:
a.append(2)
n = n / 2
# n must be odd at this point
# so a skip of 2 ( i = i + 2) can be used
for i in range(3,int(math.sqrt(n))+1,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 math
def primefact(n):
c = 0
l=[]
while n % 2 == 0:
c = c + 1
l.append(2)
n = n / 2
for i in range(3, int(math.sqrt(n)) + 1, 2):
while n % i == 0:
c = c + 1
l.append(i)
n = n / i
if n > 2:
l.append(int(n))
c... |
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())
n2=n
prime={}
z=int((n**(1/2)))
i=2
while(i<z+1):
if n%i==0:
prime[i]=prime.get(i,0)+1
n=n//i
z=int((n**(1/2)))
i=2
continue
else:
i+=1
else:
... |
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
def primeFactors(n):
ans = []
while n % 2 == 0:
ans.append(2)
n = n//2
for i in range(3,int(math.sqrt(n))+1,2):
while n % i== 0:
ans.append(i)
n = n // i
if n > 2:
ans.append(n)
return ans
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)... | n=int(input())
for i in range (n):
a=int(input())
A=[]
for i in range (2, int(a**(0.5))):
if a%i==0:
A.append(i)
a/=i
break
if (len(A) == 0):
print("NO")
continue
else:
for i in range (A[0] + 1, int(a**0.5)+1):
if 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)... | # ------------------- 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 numpy as np
#import pandas as pd
#import os
#import matplotlib
#import seaborn as sns
#import matplotlib.pyplot as plt
#from tqdm import tqdm_notebook
#%matplotlib inline
#import cv2 as cv
#import torch
#print(torch.__version__)
#torch.cuda.is_available()
#torch.version.cuda
def sqrt(p) :
lo = 0.0
hi = 10... |
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
###########
#####
try:
#######
def func1(t2,io):#############
######
##########
if len(io) >= 3 and len(t2) >= 3:######
##########
y = t2[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)... | t = int(input())
def factor(n):
arr = set({})
for i in range(2, int(n**0.5)+1):
if n % i == 0:
arr.add(i)
arr.add(int(n/i))
return arr
def find(n, arr):
for a in arr:
for b in arr:
for c in arr:
if (a != b) and (b != c) and (a != c) 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)... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 100;
int main() {
long long t;
cin >> t;
while (t--) {
long long n;
cin >> n;
vector<long long> v;
for (long long i = 2; i * i <= n; i++) {
if (v.size() == 2) {
break;
} else if (n % i == 0) {
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)... | import java.io.BufferedReader;
import java.util.ArrayList;
//import java.util.HashMap;
import java.io.InputStreamReader;
public class TEMP1
{
static boolean isp(int n)
{
for(int i=2;i<=(int)Math.sqrt(n);i++)
{
if(n%i==0)
return false;
}
return true;
}
public static void main(String args[])throws Exce... |
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())
factors = []
i = 2
while i * i <= n:
while n % i == 0:
factors.append(i)
n //= i
i += 1
if n > 1:
factors.append(n)
# print(factors)
if len(factors) < 3:
print("NO")
else:
... |
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 collections
def findDistinctTree(n):
queue = collections.deque()
queue.append(2)
i = 2
while True:
if queue:
i = queue.popleft()
else:
i += 1
if i >= n // i:
print('NO')
return
if n % i != 0:
continue
... |
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
n=int(input())
for i in range(n):
l=[]
trigger=0
a=int(input())
d=0
original=a
c=int(math.sqrt(a))
for j in range(2,c+1):
if a%j==0:
l.append(j)
a=a//j
trigger+=1
if trigger==2:
if a<original and l[0]!=a and l[1]!=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)... | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
/*
HashMap<> map=new HashMap<>();
TreeMap<> map=new TreeMap<>();
map.put(p,map.getOrDefault(p,0)+1);
for(Map.Entry<> mx:map.entrySet()){
int v=mx.getValue(),k=mx.getKey();
}for (int i = 1; i <= 1000; 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 sqrt
for i in range(int(input())):
n = int(input())
a , b , c = (None , None, None )
for i in range(2, int(sqrt(n)) + 2):
if n % i == 0:
a = i
n = n// i;
break;
if ( a != None):
for i in range(a+1, int(sqrt(n)) + 2):
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)... |
#------------------------template--------------------------#
import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase
from fractions import *
def vsInput():
sys.stdin = open('input.txt', 'r')
sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192
class ... |
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 primeFactors(n):
ans=[]
while n % 2 == 0:
ans.append(2)
n = n / 2
for i in range(3,int(math.sqrt(n))+1,2):
while n%i==0:
ans.append(i)
n = n / i
if n > 2:
ans.append(int(n))
return ans
t=int(input())
for g in range(0,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
t = int(input())
for i in range(t):
n = int(input())
sq = int(math.sqrt(n))
l = []
f = 0
for j in range(2,sq):
if n%j==0:
n = n//j
l.append(j)
f = j
if len(l) == 2:
break
elif j>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)... | ''' Ψ¨ΩΨ³ΩΩ
Ω Ψ§ΩΩΩΩΩΩ Ψ§ΩΨ±ΩΩΨΩΩ
ΩΩ°ΩΩ Ψ§ΩΨ±ΩΩΨΩΩΩ
Ω '''
#codeforces
gi = lambda : list(map(int,input().split()))
t, = gi()
for k in range(t):
n, = gi()
div = 1
sq = int(n ** .5)
for j in range(2, sq + 1):
if n % j == 0:
div = j
break
x = n // div
sq = int(x ** .5)
div2 = 1
for j in range(2, sq + 1):
if x % 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 three_multiply(n):
a, b, c = 0, 0, 0
for i in range(2, n // 2):
if i * i > n:
break
if n % i == 0:
a = i
n = n // i
break
for i in range(a + 1, n // 2):
if i * i > n:
break
if n % i == 0:
b = 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.util.*;
import java.io.*;
public class Main {
/**
*
* k = 1
*
* 2^17+1 2^17 0
* 1 2^17+1 1
*
* dp[2][2] = max(
*/
public static void main(String[] args) {
FastReader sc = new FastReader();
int t = sc.nextInt();
outer: wh... |
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)... | #------------------------------what is this I don't know....just makes my mess faster--------------------------------------
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.... |
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 warning(disable : 4996)
#pragma warning(disable : 6031)
int main() {
int c;
scanf("%d", &c);
int ans[3];
while (c--) {
memset(ans, 0, sizeof(ans));
int n, now = -1;
scanf("%d", &n);
for (int t = 2; t <= sqrt(n); t++) {
if (n % t == 0) {
now++;
... |
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)... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 21 18:49:02 2020
@author: dennis
"""
import atexit
import io
import sys
import math
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER
@atexit.register
def w... |
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 we in range(int(input())):
n = int(input())
c = 0
a = []
for i in range(2, int(n**0.5)+1):
if n % i == 0:
a.append(i)
n = n//i
if len(a) == 2:
break
if len(a) == 2 and n > a[1]:
print('YES')
print(a[0],a[1],n)
else:
... |
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,sqrt
def kFactors(n, k=3):
a = []
for i in range(2, ceil(sqrt(n))):
if(n%i==0):
n = n / i
a.append(i)
if n > 2:
a.append(n)
a = list(set(a))
if len(a) < k:
return [-1]
return [a[0],a[1]]
for i 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)... | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
long long int n, a, b, c;
cin >> n;
int flag = 0;
for (long long int i = 2; i <= sqrt(n); i++) {
if (n % i == 0) {
a = i;
flag = 1;
break;
};
}
if (flag == 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)... | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int MAX = 1000005;
const double PI = acos(-1.0);
int SetBit(int n, int X) { return n | (1 << X); }
int ClearBit(int n, int X) { return n & ~(1 << X); }
int ToggleBit(int n, int X) { return n ^ (1 << X); }
bool CheckBit(int n, int X) { retur... |
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
from math import sqrt
def solution(n):
for i in range(2, int(sqrt(n))+1):
if n % i == 0:
a = i
n_a = n // i
for j in range(2, int(sqrt(n_a))+1):
if n_a % j == 0 and j != a:
ra, rb, rc = a, j, n // (a * 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)... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Class2 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new 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(input()):
n = input()
dic = {}
x = 2
while x*x <= n:
while n%x == 0:
n /= x
if x in dic:
dic[x] += 1
else:
dic[x] = 1
x += 1
if n > 1:
dic[n] = 1
ans = []
#print dic
if len(dic) >= 3:
for i in dic:
ans.append(pow(i, dic[i]))
while len(ans) > 3:
val = ans.pop()
... |
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 = 1, b = 1, c = 1;
set<int> s;
cin >> n;
for (int i = 2; i * i <= n; i++) {
if (n % i == 0) {
a = i;
n /= a;
s.insert(a);
break;
}
}
for (int i = 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)... | """
-----------------------------Pseudo---------------------------------
"""
import copy
import sys
from collections import defaultdict, Counter
#sys.setrecursionlimit(20000)
#PI = 3.1415926535897932384626433832795
def input(): return sys.stdin.readline()
def mapi(): return map(int,input().split())
def maps(): return m... |
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, a;
cin >> t;
while (t--) {
cin >> a;
int f1 = 0, f2 = 0, rs1, rs2, rs3;
for (int i = 2; i < min(a, 100000); i++) {
if (a % i == 0) {
a = a / i;
f1 = 1;
rs1 = i;
for (int j = i + 1; j < min(a, 100000... |
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 = 0;
cin >> t;
while (t--) {
int n = 0;
int a = 0, b = 0, c = 0;
cin >> n;
for (int i = 2; i * i <= n; i++) {
if (n % i == 0) {
a = i;
n /= i;
break;
}
}
for (int i = a + 1; 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.util.*;
public class test {
static int N = (int) 2e5 + 99;
public static class pair implements Comparable<pair> {
int x;
int s;
public pair(int x, int s) {
this.x = x;
this.s = s;
}
@Override
public int compareTo(pair o) {
return (this.s - o.s);
}
}
public static void main(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)... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
static int mod=(int)1e9+7;
public static void main(String[] args) throws IOException {
FastReader sc = new FastReader();
int t=sc.nextInt();
while (t-->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)... | from math import sqrt
t = int(input())
for test in range(t):
n = int(input())
k = int(sqrt(n))
a = 0
b = 0
c = 0
for j in range(2,k+1):
if n %j == 0:
n = n//j
a = j
break
k = int(sqrt(n))
for j in range(2,k+1):
if n %j == 0 and not(j==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)... | import java.util.ArrayList;
import java.util.Scanner;
public class ProductofThreeNumbers {
public static ArrayList<Integer> factors;
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while (t-- > 0) {
int n = in.nextInt();
getFactors(n);
//brute for... |
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: guiferviz
Time: 2020-02-08 17:10:34
"""
def prime_factors(n):
factors = []
while n % 2 == 0:
n //= 2
factors.append(2)
for i in range(3, int(n**0.5 + 1), 2):
while n % i == 0:
n //= i
factors.append(i)
if n != 1:
factors.append(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 math import sqrt
for _ in range(int(input())):
n=int(input())
a=[]
s=int(sqrt(n))
for i in range(2,s+1):
if n%i==0:
a.append(i)
n//=i
if len(a)==2:
if a[1]!=n and a[0]!=n:
a.append(n)
break
if len(a)==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)... | import java.io.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.StringTokenizer;
// ΩΩΨ±Ψͺ Ψ§ΩΩΩΨ― ΩΨ§ ΩΨ¨ΩΨ± Ψ§ΨͺΩΨΆΩ
// ΩΨ§ Ψ±Ψ¨ Accepted
public class ProductOfThreeNumbers {
static ArrayList<Integer> primes;
public static void primeFactors(int n) {
while (n % 2 == 0) {
prim... |
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
q=int(input())
for j in range(q):
n=int(input())
d=[]
flag=0
for i in range(2,int(math.sqrt(n))+1):
if n%i==0:
if len(d)==2:
break
else:
d.append(i)
n=int(n/i)
if len(d)==1 or len(d)==0:
flag=1
elif len(d)==2:
if n>1:
if n!=d[0] and n!=d[1]:
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)... | # -*- coding: utf-8 -*-
"""
Created on Sat Jan 25 10:20:51 2020
@author: Anthony
"""
def abc(num):
threshold=num**0.5
myDivisors=[]
potentialDiv=2
current=num
while(potentialDiv<=threshold and current!=1):
if current//potentialDiv == current/potentialDiv:
myDivisors.append(pot... |
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=nn=int(input())
l1=[]; i=2
while len(l1)<2 and i*i<=nn:
if n%i==0: l1.append(i); n//=i
i+=1
if len(l1)<2 or l1[1]==n or l1[0]==n: print("NO")
else: print("YES"); print(l1[0],l1[1],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())
def solve(n):
ans=[]
for i in range(2,int(n**0.5)+1):
if n%i==0:
ans.append(i)
n/=i
break
if len(ans)==0:
return []
for i in range(2,int(n**0.5)+1):
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)... | def f(n):
i = 2
v = []
while i <= int(n**(1/2)) + 1:
if n % i == 0:
v.append(i)
n //= i
if len(v) >= 2:
if (n not in v) and (n != 1):
return (v[0], v[1], n)
else:
return False
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)... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using edge = tuple<int, int, int, int>;
using graph = vector<vector<edge>>;
void go() {
ll n;
cin >> n;
ll a, b, c, m;
for (a = 2; a * a <= n; a++) {
if (n % a == 0) {
m = 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)... | import sys
import math
from collections import Counter
from collections import OrderedDict
from collections import defaultdict
from functools import reduce
sys.setrecursionlimit(10**6)
def inputt():
return sys.stdin.readline().strip()
def printt(n):
sys.stdout.write(str(n)+'\n')
def listt():
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)... | import math
num = int(input())
nums = []
for i in range(num):
nums.append(int(input()))
def isPrime(num):
for i in range(2, int(math.sqrt(num)) + 1):
if num % i == 0:
return False
return True
def getDel(num, left):
for i in range(left, int(math.sqrt(num)) + 1):
if num % 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,sys
t = int(input())
answer = []
while t!=0:
t-=1
n = int(input())
num = n
if num in answer:
print('NO')
continue
even = True if num%2==0 else False
if even == True:
arr = [1]
counter = 1
else:
arr = [2]
counter = 2
while len(ar... |
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())
d = []
cnt = 2
a,b,c = 1,1,1
for i in range(2,int(n**0.5)+1):
if n%i==0:
a = i
break
x = n//a
for i in range(2,int(x**0.5)+1):
if x%i==0 and i!=a:
b = i
break
c = n//(a*b)
if a<b<c and a*b*c==n and min(a,b,c)>1:
print("YEs\n",a,b,c)
else:
pr... |
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
t = int(sys.stdin.readline().rstrip())
for _ in range(t):
n = int(sys.stdin.readline().rstrip())
i = 2
sol = []
while i<=n**(1/2):
if n%i == 0:
n = n//i
sol.append(str(i))
i+=1
if len(sol) == 2:
if str(n) not in sol and n != 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)... | #include <bits/stdc++.h>
using namespace std;
void parr(int arr[], int n, string name) {
int i;
for (i = 0; i < n; i++) cout << arr[i] << " ";
cout << "\n";
}
template <typename T>
void p(T x, string name = " ") {
cout << name << " : " << x << "\n";
}
void fn(int n) {
int a, b, c;
int i, j, temp;
bool fou... |
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())
d = set()
for i in range(2, int(math.sqrt(n)) + 1):
if n % i == 0 and not i in d:
d.add(i)
n /= i
break
for i in range(2, int(math.sqrt(n)) + 1):
if n % i == 0 and not i in d:
d.add... |
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.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t=sc.nextInt();
int a[]=new int[3];
while(t-->0) {
Arrays.fill(a,0);
int cnt=0;
int n=sc.nextInt();
for(int i=2;i<=Math.sqrt(n);i++) {
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)... | #include <bits/stdc++.h>
using namespace std;
long long t, n, z, x, c, s;
int main() {
cin >> t;
while (t--) {
cin >> n;
long long f = 0;
for (int i = 2; i * i <= n; i++) {
for (int j = i + 1; j * j <= (n / i); j++) {
z = i * j;
x = n / z;
s = i * j * x;
if (s == 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)... | """
Template written to be used by Python Programmers.
Use at your own risk!!!!
Owned by adi0311(rating - 1989 at CodeChef and 1405 at CodeForces).
"""
import sys
from bisect import bisect_left as bl, bisect_right as br, bisect # Binary Search alternative
import math
from timeit import default_timer as dt... |
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 factor(int y, int z) {
for (int i = z + 1; i * i <= y; i++) {
if (y % i == 0) return i;
}
return 0;
}
int main() {
int t;
cin >> t;
while (t > 0) {
int n;
cin >> n;
int x = factor(n, 1);
if (x >= 2) {
int m = factor(n / x, 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)... | def solve(x):
factors = []
i = 2
while i*i < x:
if x % i == 0:
x //= i
factors.append(i)
if len(factors) == 2:
break
i += 1
factors.append(x)
if len(factors) == 3:
print("YES")
print(f"{factors[0]} {factors[1]} {factors[2]}")
else:
print("NO")
def main():
t = int(input())
for i in range(... |
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 solve(n):
A=[]
for i in range(2,int(math.sqrt(n))+1):
if(n%i==0):
A.append(i)
break
if(len(A)==0):
print("NO")
return
n=n//A[0]
for i in range(A[0]+1,int(math.sqrt(n))+1):
if(n%i==0):
A.append(i)
A.append(int(n/(i)))
break
if(len(A)!=3):
print("NO")
return
if(A[0]<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)... | import sys
from collections import defaultdict
import math
def primeFactors(n):
# Print the number of two's that divide n
ans=[]
while n % 2 == 0:
ans.append(2)
n = n / 2
# n must be odd at this point
# so a skip of 2 ( i = i + 2) can be used
for i in range(3, int(math.sqrt(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
for _ in range(int(input())):
n = int(input())
flag = False
if n < 24:
print('NO')
elif n == 24:
print('YES')
print(2, 3, 4)
else:
for a in range(2, int(math.sqrt(n)) + 1):
if n % a == 0:
tn = int(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)... | t=int(input())
for k in range(t):
x=int(input())
A=[]
start=2
while((start**2)<x):
if len(A)==2:
break
if x%start==0:
x/=start
A.append(start)
start+=1
if len(A)==2:
print("YES")
print(int(A[0]),end=" ")
print(int(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)... | import math
t=int(input())
while t>0:
n=int(input())
flag=-1
for i in range(2,int(math.sqrt(n))+1):
if n%i==0:
for j in range(2,int(math.sqrt(n//i))+1):
if (n//i)%j==0 and j!=i and (n//j)//i !=j and (n//j)//i !=i and (n//j)//i !=1:
flag=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 Main{
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
//System.out.println("Enter T: ");
int T=sc.nextInt();
for(int t=0;t<T;t++){
int n=sc.nextInt();
solve(n);
}
}
public static void solve(int n) {
int n_copy=n;
Array... |
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.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
int a = 0, b = 0, c = 0;
for (int i = 2; i <= 1000 && i < n; i++) {
if (n % i == 0) {
int sum = 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 functools
import heapq as hp
import collections
import bisect
import math
def unpack(func=int):
return map(func, input().split())
def l_unpack(func=int):
"""list unpack"""
return list(map(func, input().split()))
def s_unpack(func=int, rev=False):
"""sorted list unpack"""
return sorted(m... |
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):
t=t-1
n=int(input())
c=[]
i=2
while (len(c)<2 and i*i<n):
if (n%i)==0:
c.append(i)
n=n//i
i+=1
if (len(c)==2 and n not in c):
print("YES")
print(*c,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)... | def f1(x,k):
for i in range(int(math.sqrt(x)),1,-1):
if (x%i==0):
y=x//i
if (i!=y) and (i!=k) and (y!=k):
return i
return 0
import math
t=int(input())
for i in range(t):
n=int(input())
if (n<24):
print("NO")
continue
a=0
b=0
c... |
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, ceil
def s(y, x=0):
for i in range(2, ceil(sqrt(y))):
n = y // i
if y % i == 0 and i != x and n != x and i != n :
return i, n
else:
return 0, 0
for i in range(int(input())):
x, y = s(int(input()))
y, z = s(y, x)
if y == z:
print('NO')
else:
print('YES')
print(x, y, z) |
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.Scanner;
public class ProductOfThreeNumbers{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-- > 0){
long n = sc.nextLong();
long a = 1, b = 1, c = 1;
for(long i = 2; i * 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)... | #include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin >> t;
while (t--) {
int n, a = 0, b = 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)... | t=int(input())
for i in range(t):
n=int(input())
l=[]
i=2
while(len(l)<2 and i*i < n):
if(n%i==0):
n=n//i
l.append(i)
i+=1
if len(l)==2 and n not in l:
print("YES")
print(*l,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)... | from math import sqrt
n=int(input())
for i in range(n):
t=int(input())
if t<24:
print("NO")
continue
else:
a,b=0,0
for j in range(2,int(sqrt(t))+1):
if t%j==0:
a=j
t//=j
break
for j in range(2,int(sqrt(t))+1):
if t%j==0 and j!=a:
b=j
t//=j
break
if a==0 or b==0 or t==b or 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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.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)... | import math
def primeFactors(n):
# Print the number of two's that divide n
l=[]
while n % 2 == 0:
l.append(2)
n = n / 2
# n must be odd at this point
# so a skip of 2 ( i = i + 2) can be used
for i in range(3,int(math.sqrt(n))+1,2):
# while i divides n , print i ad divide n
while 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)... | # https://codeforces.com/contest/1294/problem/C
import math
for _ in range(int(input())):
n = int(input())
l = []
i = 2
x = int(math.sqrt(n))
while i < (x + 1) and len(l)<2:
if n%i == 0:
n /= i
x = int(math.sqrt(n))
l.append(i)
i += 1
l.appen... |
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, i = 2, a = 0, b = 0, c = 0, k = 0;
cin >> n;
for (; i <= sqrt(n); i++)
if (n % i == 0) break;
n /= i;
a = i++;
for (; i <= sqrt(n); i++)
if (n % i == 0) {
k = 1;
bre... |
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 x;
int t;
cin >> t;
for (int k = 0; k < t; k++) {
cin >> x;
int a = 0, b = 0, c = 0;
for (int i = 2; i < sqrt(x); i++) {
if (x % i == 0) {
for (int j = i + 1; j < sqrt(x / i); j++) {
if ((x / i) % j == 0 && x / 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 time
s=time.time()
primes=[]
poss=[True for i in range(40000)]
for i in range(2,40000):
if(poss[i]):
primes.append(i)
for j in range(i,40000,i):
poss[j]=False
# print(primes)
# print(time.time()-s)
def find(n):
# n=int(input())
primedivisor=[]
for i in primes:
... |
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 t in range(int(input())):
n = int(input())
try:
a = list(i for i in range(2, int(n**.5)+1) if n%i == 0)[0]
n //= a
b = list(i for i in range(a+1, int(n**.5)+1) if n%i == 0)[0]
c = n // b
if c <= b:
raise
print('YES')
print(a, b, n//b)
except:
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.util.Scanner;
public class ProductofThreeNumbers {
public static int findDiv(int last, int n){
for(int i=last+1; i<Math.sqrt(n) ;i++){
if(n%i==0)
return i;
}
return -1;
}
public static void main(String[] args) {
Scanner 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)... | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
scanf("%d", &t);
while (t--) {
int n;
scanf("%d", &n);
int a = -1, b = -1, c = -1;
for (int i = 2; i * i <= n; i++) {
if (n % i == 0) {
a = i;
break;
}
}
if (a == -1)
printf("NO\n");
els... |
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;
set<int> v;
void solve() {
int n;
cin >> n;
int nn = n;
v.clear();
for (int i = 2; i * i <= n; i++)
if (n % i == 0) {
v.insert(i);
n /= i;
}
if (n > 1) v.insert(n);
if (v.size() <= 2) {
cout << "NO" << endl;
return;
}
cout << "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)... | #include <bits/stdc++.h>
using namespace std;
using namespace std;
void solve() {
int n;
cin >> n;
int arr[3];
for (int i = 2; i <= sqrt(n); i++) {
if (n % i == 0) {
arr[0] = i;
n /= i;
break;
}
}
bool good1 = false;
for (int j = 2; j <= sqrt(n); j++) {
if (n % j == 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)... | #include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
for (; b; a %= b, swap(a, b))
;
return a;
}
vector<long long> pr;
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
pr.push_back(2);
for (long long i = 3; i * i <= 1000000000; i++) {
bool flag = fals... |
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
n=int(input())
for i in range(n):
m=int(input())
m1=m
c=2
p=[]
while len(p)<3 and c<=sqrt(m1):
if m%c==0:
m=m//c
p.append(c)
else:
c=c+1
if len(p)==3:
if p[0]==p[1]:
p[1]=p[1]*p[2]
p[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 math
# N, M = map(int, input().split())
# A = list(map(int, input().split()))
T = int(input())
def primeFactors(n):
c = 1
for i in range(2,int(math.sqrt(n))+1,1):
while n % i== 0:
c = c*i
if c not in L and c > 1 and len(L) < 2:
L.append(c)
c = 1
n = n // i
# Condition if n is a pr... |
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.Vector;
import java.util.*;
import java.lang.Math;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import javax.management.Query;
import java.io.*;
import java.util.Arrays;
import java.math.BigInteger;
public class Main {
static int mod = 1000000007;
/* =========... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.