-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathPFORLOOP.py
More file actions
32 lines (26 loc) · 717 Bytes
/
PFORLOOP.py
File metadata and controls
32 lines (26 loc) · 717 Bytes
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
def getit():
allcases=[]
try:
while True:
t=map(int,raw_input().split())
allcases+=t
except:
pass
allcases=sorted(allcases)
return allcases
def main():
cases=getit()
i=cases[0]
t=0
j=cases[0]
while t<len(cases):
if not cases[t]==cases[t-1]+1 and t>0:
j=cases[t-1]
print ("for (int i = "+ str(i)+ "; i <= " + str(j)+ "; i++) cout << i << \" \";")
i=cases[t]
if t==len(cases)-1:
j=cases[t]
print ("for (int i = "+ str(i)+ "; i <= " + str(j)+ "; i++) cout << i << \" \";")
t+=1
if __name__ == "__main__":
main()