You are on page 1of 7

QUESTI

ON:
1 Expl
anat
ion: 4   pr
int
(l
1[i
])
1.Out
put Thel
ower
casechar
act
ershav
ebeenconv
ert
edt
oupper
case,
andt
heupper
casechar
act
ers 4334520987 3.I
nput
Pr
intast
ri
ngr
epr
esent
ingt
henewsy
stem passwor
d. hav
ebeenconv
ert
edt
olower
case. Out
put
: Thei
nputconsi
stsofast
ri
ngsal
esSequence,
repr
esent
ingt
hesal
esoft
heday
.
Exampl
es PROGRAM : 712224 Out
put
Exampl
e1 Expl
anat
ion: Pr
intani
ntegerr
epr
esent
ingt
hecountoft
hepr
oductt
agst
hatoccuronl
yoncei
nthesal
essequence.
I
nput s=i
nput() Thefil
eID0i
sofsi
ze43.So,i
tisstor
edi
nbucketI
D7( 4+9)
.Thef
il
eID1i
sofsi
e345.So,
iti
sst
oredi
nbuckerI
D12(
3+4+5)
.The Not
e
pri
nt(
s.swapcase(
))
bowANDar
row bucket
sfort
her
emaini
ngfi
lesarecal
cul
atedsi
mil
arl
y.
Thei
nputst
ri
ngsal
esSequencei
scaseSensi
ti
ve.Upper
casechar
act
ersandl
ower
casechar
act
ersar
ecount
edasdi
ff
erent
Expl
anat
ion: PROGRAM :
QUESTI
ON:2 Exampl
e
Thel
ower
casechar
act
ershav
ebeenconv
ert
edt
oupper
case,
andt
heupper
casechar
act
ers n=int(
input())
2.Out
put I
nput
l
1=[ ]
hav
ebeenconv
ert
edt
olower
case. Pr
intNspace-
separ
atedi
nteger
srepr
esent
ingt
hebucketI
Dsf
oreachf
il
e,r
espect
ivel
y. al
phaadi
da
sum1=0
Const
rai
nts l
=[int(
i)foriininput(
).
spl
it
()] Out
put
foriinrange(len(l
))
:
Exampl
e2 0<numFi
l
es<106 4
  sum1=0
I
nput
: 0<f
il
eSi
ze<106   while(l
[i
]>0): Expl
anat
ion
Hel
l
oWor
ldPeopl
e     rem=l[i]
%10
0<i
<numFi
l
es Thepr
oductt
agst
hatoccur
redoncei
nthesal
essequencear
el,
p,
h,
iSot
heout
puti
s4.
    l[
i]=l[i
]//10
Out
put Exampl
e     sum1=sum1+r em PROGRAM :
HELLOWORLDPEOPLE   l1.
append( sum1)
I
nput i
mpor
tjav
a.i
o.Buf
fer
edReader
;
foriinrange(len(l
1))
:

i
mpor
tjav
a.i
o.I
nput
Str
eamReader
; } I
nput i
ntcount
=0;
}
i
mpor
tjav
a.ut
il
.Scanner
; } Thei
nputconsi
stsofast
ri
ngser
amer
epr
esent
ingt
heuser
name
i
f(count==1)
{
cl
assMai
n m+=1; Out
put char
[]ar
r=s.
toChar
Arr
ay(
);
{ count=0;
} Pr
intani
ntegerr
epr
esent
ingt
het
otal
countofdi
git
spr
esenti
ntheuser
name f
or(
int
i=0;
i
<ar
r.
lengt
h;i
++)
{
publ
icstat
icvoi
dmain(St
ri
ngargs[
]) }
{ System.out.
pri
nt(
m); PROGRAM : i
f((
int
)ar
r[
i]
>=48&&(
int
)ar
r[
i]
<=58)
{
Scannersc=newScanner(
Syst
em.i
n); }
} i
mpor
tjav
a.i
o.Buf
fer
edReader
; count
+=1;
charar
r[
]=sc.
next
Line(
).
toChar
Arr
ay(
);
i
mpor
tjav
a.i
o.I
nput
Str
eamReader
;
i
ntcount=0; }
i
mpor
tjav
a.ut
il
.Scanner
; }
i
ntm=0;

f
or(
int
i=0;
i
<ar
r.
lengt
h;i
++)
{ cl
assMai
n
{ Syst
em.out
.pr
int
(count
);
f
or(
intj
=0;
j
<ar
r.
lengt
h;j
++)
{ }
}
i
f(
arr
[i
]==ar
r[
j]
){ QUESTI
ON:4 QUESTI
ON: 5
publ
icst
ati
cvoi
dmai
n(St
ri
ngar
gs[
])
count
+=1; 4.Tocr
eat
eapr
ofi
l
eonasoci
almedi
aaccount {

ThePassBook,theuserneedstoent
erast
ringvaluei
nthefor
m ofuser
name.Theuser
nameshoul
dconsi
stofonlychar
act
erstagged 5.Thecompanywi
shest
oknowt
henumberofpr
ofi
tabl
eday
sint
hel
i
st.
i
f(
count
>1)
{
a-z.I
ftheuserenter
sanincorr
ectst
ri
ngcontai
ningdi
git
sthesyst
em aut
omati
cal
lyi
denti
fi
est
henumberofdi
git
sinthestr
ingand /
/li
ri
tey
ourcodeher
e Wr
it
eanal
gor
it
hm t
ohel
pthecompl
aryknowt
henumberofpr
ofi
tabl
eday
sint
hel
i
st.
count
=0;
removesthem. Scannersc=newScanner(
Syst
em.
in)
; I
nput
br
eak; Str
ings=sc.next
Line(
);
Wr
it
eanal
gor
it
hm t
ohel
pthesy
stem i
dent
if
ythecountofdi
git
spr
esenti
ntheuser
name
Thef
ir
stl
i
neofi
nputconsi
stsofani
ntegernumDay
srepr
esent
ingt
henumberofday
s(N)
.Thesecondl
i
neofI
nputconsi
stsofN-
spacesepar
atedi
nteger
ssal
es[
1]–sal
es[
N-1]r
epr
esent
ingt
hesal
esv
alueofNday
srespect
ivel
y. 6.I
nput Thei
nputconsi
stsofast
ri
ngmessager
epr
esent
ingt
hemessaget
hatneedt
obedecodedbyt
heagency
.
Out
put Thefi
rstl
i
neoft heinputconsi
stsofanint
eger-key
,repr
esent
ingt
hekeyv
aluef
ort
heencr
ypt
ionThesecondl
i
neconsi
stsofa Out
put
st
ri
ng-dataSt
r,r
epresenti
ngthedatastr
ingtobeencrypt
ed.
Pr
intani
ntegerr
epr
esent
ingt
henumberofday
sthecompanymadeapr
ofi
t Pr
intani
ntegerr
epr
esent
ingt
henumberofchar
act
ersi
nthegi
vensequence.
Out
put
Exampl
e PROGRAM :
Pr
intast
ri
ngr
epr
esent
ingt
heencr
ypt
eddat
ast
ri
ng symbol s=*-!
@#$%^ &*()?
><?
/\_
\**:;
I
nput
C=8
Const
rai
nts
7 n=raw_ i
nput()
0<l
en<1000,
leni
sthel
engt
hoft
hegi
vendat
ast
ri
ngdat
aSt
r for1-i
nr ange(l
en(
n)):
23-
713-
345643-
12     i
f-
n[i]
-i
n-symbols:
0<key
<100        c+=1
PROGRAM :  pr
int(c)
n=int(raw_ i
nput()
) Not
e
c=0
Thedat
aSt
rcancont
ainl
ower
caseandupper
caseEngl
i
shl
ett
ers(
ie.a-
z,A-
Z).
l
=i nt(i
).forii
nr aw_input
().
spl
it
()]
 
forii
nr ange( l
en(1))
: PROGRAM :
   i
f1[1]>0:
     c+=1 N=i nt(raw_i
nput())
 
 pr
int(c) QUESTI
ON :
7
S=r aw_ i
nput(
)
 r
es=""
foriin-
range(len(
s)):
   res-r
es+chr(ord(
s[i
])
+n)
  7.SecretMessageagencyprovi
desmessageencodi
nganddecodi
ngservi
cesf
orsecur
edatatransf
er.Thef
ir
ststepi
ndecodi
ng
pri
nt( r
es) i
ncludesremovalofspeci
alchar
act
ersfr
om themessage,
asspeci
alchar
act
ersandwhi
tespacesdonotholdanymeani
ng.
Wr
it
eanal
gor
it
hm t
ohel
ptheagencyf
indt
henumberofspeci
alchar
act
ersi
nagi
venmessage
I
nput
QUESTI
ON:6

7 foriinrange(n): I
NPUT
Ifispri
me( l[
i]
):
2953148017 Thefi
rstl
ineofinputconsi
stsofanintegernumDaysrepresent
ingt
henumberofday
s(N)
.Thesecondli
neofi
nputconsi
stsofNspace
p.append( l
[i
])
else: separ
atedint
egers-sales[
0],
sal
es[
1],sales[
N-I
]repr
esent
ingthesal
esofval
ueofNdaysr
espect
ivel
y.
Out
put
:
np.append( l
[i]

 forxi
nnp: OUTPUT:
2531791480 p.append( x)
foriinrange(len(
p)) PRI
NTANI
NTEGERREPRESENTI
NGTHENUMBEROFDAYSTHECOMPANYMADEAPROFI
T
Expl
anat
ion:
print(
[1])
. EXAMPLE:
QUESTI
ON 8: I
nthegi
veni
nputt
hepr
imenumber
sar
e-[
2,5,
3,
17]andt
henon-
pri
menumber
sar
e-[
9,14,
80]
I
NPUT:
I
NPUT: So,
theout
puti
s[2,
5,3,
17,
9,14,
80]
.
7
Thesecondl
i
nesconsi
stofNspace-
separ
atedi
nteger
s-pr
odI
D1.pr
odI
D2.
..
.,
prodI
DN,
repr
esent
ingt
heI
Dsf
ort
hepr
oduct
sint
heshop. PROGRAM :
23–7-
13-34-56-43-12
OUTPUT: def
ispr
ime(
n):
OUTPUT:
Pr
intNspace-
separ
atedi
nteger
srepr
esent
ingal
lpr
imenumberI
Dsf
oll
owedbyal
lnon-
pri
menumberI
Dsi
ntheor
deri
nwhi
cht
heyappear f
lag=Fal
se
i
ntheinput
.
i
fn>1:
CONSTRAI
NTS: foriinrange( 2,n): PROGRAM :
i
f(n%i ==0) :fl
ag=Tr ue
0<numPr s<103
oduct breaki fflag:returnFalse
N=i nt(r
awI nput(
))
c=0
2<Pr
od1,
Prod2,
….Pr
odI
D<10 3 else: l
=[int
(1)-
for-
iinrawinput
().
spl
i
t()

returnTr uen=i nt(
raw_ i
nput(
)) QUESTI
ON:9  f
or1i nrange(l
en(1))
:
Exampl
e l
=[ int(i
)foriinr aw_ i
nput(
).
spli
t(
)]      i
f1[i]
>=0:
Thecompanywi
shest
olknowt
henumberofpr
ofi
tabl
eday
sint
hel
i
st.         
c+=1
I
nput
: p=[] pri
nt(c)
np=[ ] Wr
it
eanal
gor
it
hm t
ohel
pthecompanyknowt
henumberofpr
ofi
tabl
eday
sint
hel
i
st.
Wr
it
eanal
gor
it
hm t
odi
spl
ayt
heal
phabet
icpr
oductcodef
rom t
henumer
icbar
code.
publ
icst
ati
cvoi
dmai
n(St
ri
ngar
gs[
]){
I
NPUT:
Scannersc-
newScanner
(Sy
stem.
in)

Thei
nputconsi
stsofani
nteger-bar
code,
thatr
epr
esent
sthebar
codeoft
hepr
oduct
.
char
[]ar
r=sc.
next
Line(
).
toChar
Arr
ay(
);
Out
put
char[
]al
p={ '
a'
,'
b'
,'
c',
'
d',
'e'
,
'f
',
'
g',
'h'
,
'1'
,
''
);
Pr
intast
ri
ngr
epr
esent
ingt
heal
phabet
icpr
oductcode  
int[
]num =newint
[9]
;

CONSTRAI
NTS: f
or(
int
i=0;
i
<ar
r.
lengt
h;i
++)
{

code<1010
0<bar num[i
]=Int
eger.parseInt
(Char
act
er.
toSt
ri
ng(
arr
[i
])
);
}f
or(i
ntj
-0;j
<arr
.length;j
++){
EXAMPLE: Syst
em.out
.pri
nt( al
p[num[j
]]
);
}
I
NPUT: }
}
12403
OUTPUT:
BCEAD
PROGRAM :
QUESTI
ON:
10 mpor
I tjav
a.i
o.Buf
fer
edReader
;
 
importj
ava.
io.
InputStr
eamReader
;
anumeri
cvalueandthealphabet
icpr
oducti
sast r
ingval
uet
agged'a-
j'
.Theal
phabet
icrange'
a-j
'repr
esent
sthenumeri
crange'
0-9'
.To  
importj
ava.
uti
l.Scanner; QUESTI
ON:11
pr
oducethealphabet
icpr
oductcode,
eachdigi
tinthenumer
icbar
codeisrepl
acedbythecorr
espondingmatchi
ngl
ett
ers.  
classSol
uti
on
 
{ Fer
ti
li
tyVal
uer
epr
esent
ingt
hef
ert
il
it
yval
ueoft
hesoi
lassi
gnedt
oeachbl
ock.pur
poseofanal
ysi
s,t
heywi
sht
ocal
cul
atet
het
otal
fer
ti
li
ty

valueofthebl
ocksthatar
eplowedeachday.Thet ot
alfer
ti
li
tyv
aluei
scalcul
atedbyaddi
ngt
hef
ert
il
it
yval
uesofal
lthebl
ocks.
Wri
tean r
etur
nsum PROGRAM:
r
etur
n
algori
thm t
ofi
ndthetotal
fer
ti
li
tyval
ueoftheblocksplowedonfir
stday sum=0
defmai n()
: l
=[i
nt(
i)f
orii
nraw_
input
().
spl
i
t()
]
I
NPUT:
    fer
til
it
yValue=[ ]
  QUESTI
ON:12
11=[i
nt(i
)foriinraw_i
nput(
).
spl
it
()]
Thefi
rstl
ineoftheinputconsi
stsofanint
egernumBlocks,representi
ngt henumberofblocks(
N).Thesecondl
ineconsi
stsofNspace-     fer
til
it
yValue_si
ze=int(r
aw_ i
nput()
)
hest
arti
ndexofthegivenli
st(
L)andtheendindexofthegiv
enl
ist(
R).Thesecondl
i
neofi
nputconsi
stsofNspacesepar
atedi
nteger
s- for
iinrange(l
[1]-
1,l
[2]


    fer
til
it
yValue-li
st(
map( i
nt,
rawInput(
).
spl
it
())
)-
separ
atedint
egers-fert
il
it
yVal
ue1,f
ert
il
it
yVal
ue3.
..
..
.fer
ti
li
tyValuenrepresenti
ngthefer
ti
li
tyval
ueofthesoi
lassi
gnedtoeachblock.     r
esultfi
ndFerti
li
tyValue(
fer
til
it
yVal
ue)  el
ement[
0],
element[
1]..
..
..
..
..
..
.el
ement[
N-1]r
epresent
ingt
henumbersinthel
ist
.   sum=sum+l
1[i
]
     pr
intresul
t,
OUTPUT: pri
nt(
sum)
OUTPUT :
 i
f__name__
=="
__mai
n__
":
Pr
intani
ntegerr
epr
esent
ingt
otal
fer
ti
li
tyv
alueoft
hebl
ockspl
owedonf
ir
stday
.
     mai
n() Pr
intani
ntegerr
epr
esent
ingt
hesum ofal
lthenumber
swi
thi
nthegi
venr
angei
ncl
usi
veofLandR.
CONSTRAI
NTS:
CONSTRAI
NTS:
ocks<105
0<numBl
0<LI ZE<106
STSI
106<f
- ert
il
it
y ue<106
Val
0<MI
NRANGE,
MAXRANGE<LI
STSI
ZE
0<I<numBl
ocks
EXAMPLE:
PROGRAM :
I
NPUT:

def
f i
ndfer
ti
li
tyVal
ue(
fer
ti
li
tyVal
ue)
: 836
   
i=0
12344581261714
   
i=i+2
   sum=0 OUTPUT:
whi l
e(i
<len(
fer
ti
li
tyVal
ue)
):
    sum+=f er
ti
li
tyVal
ue[
i] 71
    i+=2
c1+=1 scanf
("%d%d"
,&b1,
&h1)
;
el
if(
l1[
i]
==mi)
:
QUESTI
ON:13 scanf
("%d%d"
,&b2,
&h2)
;
c2+=1ifcl
>c2:pr
int(
c1-
c2)el
se:pr
int
(c2-
c1)
I
NPUT: ar
ea1=(
b1*
h1)
*0.
5;
8 QUESTI
ON:14 ar
ea2=(
b2*
h2)
*0.
5;
21554411 Anarchi
tecti
si nchar
geofdesi
gni
ngthelayoutofacommer ci
albuil
dingTri
angul
artr
usseswi
ll
supportt
heroof
topofthebuil
ding.For i
f(
area1>ar
ea2)
bett
ersupportofther
oof
topthear
chit
ectmustchoosetrusseswiththelar
gestar
eaf r
om t
heavai
l
ablest
ockThetrussesar
etriangul
ar
OUTPUT: {
fr
amewor kswhoseareai
sgivenbythefor
mul aAreaofatr
iangl
e=( BASE*HEIGHT)/
2
1 pr
int
f("
%f"
,ar
ea1)
;
Wr
it
eanal
gor
it
hm t
ohel
pthear
chi
tectf
indt
hear
eaoft
hel
argestt
russes.
EXPLANATI
ON: }
I
NPUT:
Themaximum numberofproductsi
nstockareforproductID1andt
hemini
mum numberofpr
oduct
sthatarei
nst
ockar
eforpr
oductI
D2 el
se{
Thefir
stl
ineoftheinputconsi
stsoft
wospaceseparat
edposi
ti
vei
nteger
s-bl.arepr
esent
ingthebaseandhei
ghtoft
hef i
rstt
russes.The
but1<2sowecannotselecti
t.Thusweselectproducti
D5or4asbothar
egreat
erthan2(
5>2and4>2)havi
ng2pr
oduct
sinst
ockSothe
secondli
neconsist
soft wospacesepar
atedposi
ti
veint
eger
s-2h2,repr
esenti
ngthebaseandheightoft
hesecondt
russes. pr
int
f("
%f"
,ar
ea2)
;
maximum di
ff
erencebet
weent henumberofproductswill
he21–
PROGRAM : }
PROGRAM :
#i
ncl
ude<st
dio.
h> r
etur
n0;
i
mpor tmat h
n=raw_input() i
ntmai
n() }
l
1=[int
(i
)f oriinraw_i
nput()
.spli
t(
)]
{
m=max( l1,key=l1.
count)
mi=min(l1,key=l1.
count) i
ntb1,
h1,
b2,
h2;
c1=0
c2=0forii nrange(l
en(l
1))
:if(
l1[
i]
==m)
: f
loatar
ea1,
area2;

50 ent
erdbyt
heuser
.Bot
hnumber
sar
econsi
der
edi
nther
ange.
PROGRAM : Out
put
:
i
mpor
tmat
h Pr
intani
ntegerr
epr
esent
ingt
hesum oft
hel
argestandsmal
l
estpr
imenumber
sint
her
angeofgi
vennumber
s.
l
=[i
nt(
i)f
orii
ninput
().
spl
i
t()
] Const
rai
nts:
QUESTI
ON:15 l
1=[
]
-
10^
9<=-f
ir
stNumber<secondNumber<=10^
9
I
nput f
orii
nrange(
l[
0],
l
[1]
+1)
:
Exmapl
e:
Thei
nputconsi
stsoft
wospace-
separatedi
nteger
s-f
ir
stNumber
andsecondNumber
,repr
esent
ingt
het
wonumber
sent
eredbyt
heuser
. i
fabs(
i)
>1:
I
nput
Bot
hnumbersareconsi
der
edintherange.
f
orji
nrange(
2,abs(
i)
):
BocaNOWN
-
9750
i
fi
%j==0:
Out
put Out
put
br
eak
Pri
ntani
ntegerr
epresenti
ngt
hesum oft
hel
argestandsmal
l
estpr
imenumber
sint
her
angeofgi
vennumber
s.8#War
ning:
Pri
nti
ng 50
el
se:
unwant
edor111-for
mat t
ed Code:
l
1.append(
i)
EXAMPLE:
pr
int
(abs(
max(
l1)
+mi
n(l
1))
)
I
NPUT:
i
mpor
tmat
h

1) l
=[i
nt(
i)f
ori
ini
nput
().
spl
i
t()
]
-
9750
Thei
nputconsi
stsoft
wospacesepar
atedi
nteges-f
ir
stNumberandsecondNumber
,repr
esent
ingt
het
wonumber
s l
1=[
]
OUTPUT:
f
ori
inr
ange(
l[
0],
l
[1]
+1)
: setassi
gnedt
othest
udent
.Ifcaseofno a=[
'
A',
'
B',
'
C',
'
D',
'
E',
'
F',
'
G',
'
H',
'
I'
,'
J'
,'
K'
,'
L'
,'
M',
'
N',
'
O',
'
P',
'
Q',
'
R',
'
S',
'
T',
'
U',
'
V',
'
W',
'
X',
'
Y',
'
Z'] wher
ethef
il
eisst
ored.
i
fabs(
i)
>1: out
putpr
int-
1. whi
l
e(n>0)
: Wr
it
eanal
gor
it
hm t
ofi
ndt
hebucketI
Ds
f
orj
inr
ange(
2,abs(
i)
): Const
rai
nts sum=sum+(
n%10) wher
ethef
il
esar
est
ored.
i
fi%j
==0: 0<=apl
i
cat
ionI
D<=10^
9 n=n/
/10 I
nput
br
eak Exampl
es i
fsum<=26: Thef
ir
stl
i
neoft
hei
nputconsi
stsofan
el
se: Exampl
e1 pr
int
(a[
sum-
1]) i
ntegernumFi
l
esr
epr
esent
ingt
henumberof
l
1.append(
i) I
nput el
se: f
il
est
obest
ored(
N).
pr
int
(abs(
max(
l1)
+mi
n(l
1))
) 6442 whi
l
esum>0: Thesecondl
i
neconsi
stsofNspacesepar
ated
2) Out
put sum1=sum1+(
sum%10) i
nteger
s–f
il
eSi
ze1,
Fil
esi
ze2.
..
..
.
I
nput P sum=sum/
/10 f
il
eSi
zeNr
epr
esent
ingt
hesi
zesoft
hef
il
es.
Thei
nputconsi
stsofani
nteger-appl
i
cat
ionI
D, i
fsum1<=26: Out
put
r
epr
esent
ingt
henumer
icappl
i
cat
ionI
Doft
he Pr
ogr
am: pr
int
(a[
sum-
1]) Pr
intNspace-
separ
atedi
nteger
srepr
esent
ing
st
udent n=i
nt(
input
()) 3) t
hebuckerI
Dsf
oreachf
il
e,r
espect
ivel
y.
Out
put sum1=0 t
hesum oft
hedi
git
sofi
tsf
il
esi
ze.Theser
ver Const
rai
nts
Pr
intachar
act
err
epr
esent
ingt
het
estpaper sum=0 r
etur
nst
hebucketI
Dforev
eryf
il
erequest 0<=numFi
l
ess10^
6

O<=f
il
eSi
zei
<=10^
6 4) Wehav
e6cont
ainer
swi
thcapaci
ty(
100,
560, 500
O<=i
<numFi
l
es Exampl
e1: 23,
19,
53,
20)
,sowecanf
ormt
hef
oll
owi
ng Pr
ogr
am:
I
nput6 pai
rsofcont
ainer
s-(
560,
19)
,(100,
20)
,(53, n=i
nt(
input
())
Pr
ogr
am: 23) l
=[i
nt(
i)f
ori
ini
nput
().
spl
i
t()
]
n=i
nt(
input
()) 10056023195329 i
f(
n%2==0)
:
l
=[i
nt(
i)f
ori
ini
nput
().
spl
i
t()
] Exampl
e2: f
ori
inr
ange(
n//
2):
l
2=[
] Out
put m=[
]
f
ori
inr
ange(
0,n)
: 56019 I
nput m.
append(
max(
l)
)
k=l
[i
] 10020 m.
append(
min(
l)
)
sum=0 5223 7 f
ori
inr
ange(
len(
m))
:
whi
l
ek>0: 99123771243850 pr
int
(m[
i]
)
sum+=k%10 Expl
anat
ion: Out
put
: pr
int
("
")
k/
/=10 1238 l
.r
emov
e(max(
l)
)
l
2.append(
sum) 9912 l
.r
emov
e(mi
n(l
))
pr
int
(''
.
joi
n(map(
str
,l
2))
) 7743 el
se:
f
ori
inr
ange(
n//
2): 4 sum1=0 Pr
ogr
am
i
f(
i==n/
/2)
: 4334520987 whi
l
e(l
[i
]>0)
: s=i
nput()
pr
int
(l
[n-
2]) Out
put
: r
em=l
[i
]%10 pri
nt(
s.swapcase(
))

el
se: 712224 l
[i
]=l
[i
]/
/10 8)Thef irstlineoft heinputconsi stsofan
i
rteger-key ,
repr esentingt iekeyv alue
m=[
] Expl
anat
ion: sum1=sum1+r
em
fortheencr ypt i
on.
m.
append(
max
(l)
) Thef
il
eID0i
sofsi
ze43.
So,
iti
sst
oredi
nbucketI
D7(
4+9) l
1.append(
sum1) Thesecondf ineconsi stsofast r
ing-
dataSt r,represent ingthedat ast r
ingto
m.
append(
min(
l)
) Thef
il
eID1i
sofsi
ze345.
So,
iti
sst
oredi
nbucketI
D12(
3+4+5) f
ori
inr
ange(
len(
l1)
):
beencr ypted
f
ori
inr
ange(
len(
m))
: Thef
il
eIDsf
ort
her
emai
ningf
il
esar
ecal
cul
atedsi
mil
arl
y pr
int
(l
1[i
]) Out put
Printast nngr epr esentingt heencr ypt
ed
pr
int
(m[
i]
) 7)
Exampl
e
datast ring.
pr
int
("
") Pr
ogr
am: I
nput
: Const raints
0<l en<=1000.l eni sthel engt hofthe
l
.r
emov
e(max(
l)
) n=i
nt(
input
()) bowANDar
row
givendat ast nngdat aStr
l
.r
emov
e(mi
n(l
)) l
1=[
] out
put
: 0<=key<=100
Not e
5) sum1=0 BOWandARROW
Thedat aSt rcancont am l ower caseand
Exampl
e l
=[i
nt(
i)f
ori
ini
nput
().
spl
i
t()
] Expl
anat
ion: upper caseEngl ishl ett
er s(i.
e..a-Z.AZ)
I
nput f
ori
inr
ange(
len(
l)
): Thel
owercasechar
act
ershav
ebeenconv
ert
edt
oupper
case,
andt
heupper
casechar
act
ershav
ebeenconv
ert
edt
o pr
ogr
am:
l
owercase

al
phaadi
da if
(count>1)
{
n=int(
input(
)) count=0; Thei
nputconsi
stsofst
ri
ng–user
name,
repr
esent
ingt
heuser
name
s=input() Out
put break;
res="" 4 } Out
put
:
foriinrange(l
en(
s)): }
res=res+chr
(or
d(s[
i]
)+n) Pr
ogr am: } Pr
intani
ntegerr
epr
esent
ingi
ntheuser
name
print
(res) i
mpor tjava.i
o.Buf feredReader ; i
f(
count==1)
{
i
mpor tjava.i
o.Input StreamReader ; m+=1; Pr
ogr am
8) i
mpor tjava.uti
l.Scanner ; count
=0; i
mpor tjava.i
o. Buf feredReader ;
I
nput
: cl
assMai n } i
mpor tjava.i
o. Input StreamReader ;
Thei
nputconsi
stesofst
ri
ngsal
esSequencer
epr
esent
ingt
hesal
esoft
heday
. { } i
mpor tjava.util.Scanner ;
publi
cst ati
cv oidmai n(St
ringargs[]
){ Syst
em.
out
.pr
int
(m)
; cl
assMai n
Output
: Scannersc=newScanner (
System.i
n); } {
Pri
ntanint
egerr
epr
esent
ingt
hecountoft
hepr
oductt
agst
hatoccuronl
yoncei
nthesal
essequence charar r
[]
=sc. nextLine().
toCharArr
ay()
; } publi
cst aticv oi dmai n(Stri
ngar gs[]
){
i
ntcount =0; Scannersc=newScanner (System.i
n);
Not
e: i
ntm=0; 9) Stri
ngs=sc. nextLine();
for
(inti=0;i
<ar r.
length;i
++) Tocreat
eaprofi
leonasoluti
onmedi aaccount“ThePassBook”,
theuserneedstoenterastr
ingval
ueinthef
orm of i
ntcount =0;
Theinputst
ri
ngsal
esSequencei
scasesensi
ti
ve.Upper
casechar
act
ersandl
owercasechar
act
ersar
ecount
edas { user
name.Theuser
nameshoul dconsistofonl
ycharacter
staggeda-z.I
ftheuserent
ersanincor
rectst
ri
ngcont
aini
ng char[]arr=s. toChar Array();
di
ff
erent. for(
intj=0;j<arr.
length;j
++) di
git
sthesyst
em automat
ical
lyident
if
iesthenumberofdi gi
tsi
nthestri
ngandr emovesthem. for(
inti=0;i<ar r.
length;i++)
{ {
Exampl
e: if
(arr[
i]==ar r
[j
]) Wr
it
eanal
gor
it
hm t
ohel
pthesy
stem i
dent
if
ythecountofdi
git
spr
esenti
ntheuser
name. i
f((i
nt)arr[i]
>=48&&( int)arr
[i
]<=58)
{ {
I
nput
: count +=1; I
nput
: count +=1;
} I
nput r
es.
append(
l1[
i]
)
} Thefir
stli
neofinputconsist
softhreeint
eger s-
Syst
em.
out
.pr
int
(count
); days,minRange,maxRangerepresent
ingthe
} numberofday s(N),
themi ni
mum temperat ure f
ori
inr
ange(
len(
res)
):
} (L)andthemaximum t emperat
ure(R).
11) Thesecondl i
neconsistsofNSpacesepar ated pr
int
(res[
i]
)
“Cl
imat eToday ’
isamedi ampanyt hatpr ovides
commer cialweat herf orecastingserv
ices, They
haveal istoft emper at
uresf oraparti
cular
l
ocationf orNday sandhav eal r
eadyprepar ed i
nteger
s-t
emp1,
temp2-
--
-tempn-
1
theforecastr epor twi t
hinther angeLtoRwher e
Listhemi nimum t emper atureandRi sthe r
epr
esent
ingt
het
emper
atur
eofNday
s
Maximum t emper at urefrom thegivenlist.Now,

cl
i
mst
eToday
”needst
oknowt
het
emper
atur
e
Pr
ogr
am
f
ortheday
sthatar
enoti
ncl
udedwi
thi
nthe l
=[i
nt(
i)f
ori
ini
nput
().
spl
i
t()
]
LtoR.
l
1=[
int
(i
)fori
ini
nput
().
spl
i
t()
]
wri
teanalgor
it
hm t
ohelpthecompanyprepar
e r
es=[
]
t
helistoft
emperat
urest
hatarenoti
ncl
udedin
t
herangeLtoR. f
ori
inr
ange(
len(
l1)
):
i
fl1[
i]
<l[
1]orl
1[i
]>l
[2]
:

You might also like