Segmented Sieve [ Number Theory ]
Zobayer Blog
Implementation 01:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include<bits/stdc++.h>
using namespace...
Showing posts with label Math. Show all posts
Showing posts with label Math. Show all posts
12461 - Airplane
12461 - Airplane
EXPLANATION
Solution:
//copy
1
2
3
4
5
6
7
8
9
10
11
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
while(cin >> n && n){
cout << "1/2\n";
}
return 0;
}
function copyText(){
var outputText = "";
var targets = document.getElementsByClassName('codebox');
for...
Euler’s Phi Function
Euler’s Phi Function:
Concept:
Shoshikkha
প্রোগ্রামিং পাতা
topH
Type 01:
( যখন একসাথে অনেক গুলোর জন্য বের করতে হবে।)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<bits/stdc++.h>
using namespace std;
#define...
Count Divisors
Count Divisors
Solution 1:
Complexity: sqrt(n)
#include<bits/stdc++.h>
using namespace std;
int countDivisors (int n)
{
int cnt = 0;
for(int i = 1; i <= sqrt(n); i++){
if(n % i == 0){
if(n/i == i)cnt++;
...
Large Number Factorial
>> Large Number Factorial:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define INF 10000000
#define MAX 500
int multiply(int x, int res[], int res_size);
void factorial(int n)
{
int res[MAX];
res[0]...