Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Goin Sec Reg.

no
Nihbhay
Name'
kuma
Space Time
pintf( t tt
iottinclude
int int maininC)
complexity i:o;i<n++)
max.Sum) Fo(int
int int inclUde
219302192
5c
plexitJ Setu cusent-Sut
Sum as3ay
iFCCu3sentSUm<o)F(Cu33ent- CiJ
assay
mo: maximu-SobasaySum
ax-Sum Cuyent-um
max-Sum ) cu5ent.Su
max-Sum
The Size max <
i
imStdio. <

:- : =of(
mJ=,2,3, -Sum tS.h>
aximummaXimum
a43
o0) on) NT- m
; = ASSignmentil
ay)/Siteof 0:
Sobogy MIN, DAA
-
Suba33ay-Sum(aJS -4, (int
(a43ay 5,
6, *as
Som
-7, ,ay.nt
i8 Co3)
8,
od\max-Sn) ; 9
3;
ayn): )
c)vde<ma
tin # Soin; Q2.
*incIude<
void th.h Stdlb
EatoSthenes
h> Ci)Sieve of
Psintf("\o")
moo)int P3intf("Psime
fo3(i:2int Foa(int
18-Pime i<2ni++}
fos(int
iz0: include<stdio.n>
#inc0de
n30;
SieveofE3atoSthene
C) int iFCiS-p3imeCi){ ie(iS-PimeCiJ)} i-PSimelnt); bool
Fo( sieve
i8-PzimeliJ
FaiSe i:2 <
int [o] ofEsotosthene8 Std
j bcoj
=i*i i iS-
i<:n;i++)numbe *ic=n;i++){
Paime h>

:
upto j<=n;j+i) li]:EolSe
Cint
olod n)
ac
:\9);
ein) (1) Ci)
Bute Si Time Veidtinc)vde
Psintflcmathh>
Fos(it fos(int civde
tin Bsute
PintF"a3
mainint )
e Find int 3
iF(S-Psime
ve i
complexity ttFìndPSimesß
fogce oF PimeButefosceStast* Paintt('dod',
iJ; byeak Fosce
Psime
i:
EgatoSthene
j iS- <
2:j<=
pBìme; Stat St
4 )O,end appo9ch
numbes&i dio
pp3o
SutefcCeCint .h)
QCh naySi S93tci)jt+)
<=end i
50 -
(Stat, the
Space Time 8 :i++)f
SpaceTime - end); 4nge
+agt,.nt
Compie
xyi-
oCi)compie
Complexity
oC^) i- co /
mpiexity d
xity to end
- oja
d )
Cn) o i- aae:\a")
OCn
loglogn)
Stast,

end
J

You might also like