Skip to content

Commit 6df5d2e

Browse files
authored
Add files via upload
commit for the sol of codechef long challenge
1 parent 7a4cf15 commit 6df5d2e

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed

sol3.cpp

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#include <iostream>
2+
#include<algorithm>
3+
#include<stdio.h>
4+
5+
6+
using namespace std;
7+
8+
9+
void quicksort(int a[],int first, int last){
10+
int i;
11+
int j;
12+
int pivot;
13+
int temp;
14+
if(first < last){
15+
i = a[0];
16+
j = a[last];
17+
pivot = a[0];
18+
19+
while(i<j){
20+
21+
while(a[i] <= a[pivot]){
22+
i++;
23+
}
24+
25+
while (a[j] > a[pivot]){
26+
j--;
27+
}
28+
29+
30+
if(i > j){
31+
temp= a[i];
32+
a[i] = a[j];
33+
a[j] = temp;
34+
}
35+
36+
}
37+
temp = a[pivot];
38+
a[pivot] = a[j];
39+
a[j] = temp;
40+
41+
quicksort(a,first,j-1);
42+
quicksort(a,j+1,last);
43+
}
44+
45+
46+
}
47+
int f2(int x){
48+
int x;
49+
50+
}
51+
52+
53+
int f1(int n)
54+
{
55+
56+
57+
int t=0;
58+
while (n % 2 == 0)
59+
{
60+
t++;
61+
n = n/2;
62+
}
63+
64+
65+
for (int i = 3; i <= sqrt(n); i = i + 2)
66+
{
67+
68+
while (n % i == 0)
69+
{
70+
t++;
71+
n = n/i;
72+
}
73+
}
74+
75+
76+
if (n > 2)
77+
t++;
78+
79+
return t;
80+
}
81+
82+
83+
int main() {
84+
int t;
85+
cin>>t;
86+
for(int i=1;i<=t;i++)
87+
{
88+
int x1,k1;
89+
90+
cin>>x1>>k1;
91+
92+
int ans=f1(x);
93+
94+
if(ans>=k1){
95+
cout<<'1'<<\n;
96+
}
97+
98+
else{
99+
cout<<'0'<<\n;
100+
}
101+
102+
}
103+
104+
}

0 commit comments

Comments
 (0)