Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5dd9942

Browse files
RezwanRezwan
Rezwan
authored and
Rezwan
committed
Modified
1 parent 9ab83d0 commit 5dd9942

10 files changed

+244
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
n = int(input())
2+
while n != 42:
3+
print(n)
4+
n = int(input())

‎CodeChef/N different palindromes.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from string import ascii_lowercase
2+
T = int(input())
3+
for i in range(T):
4+
chars = ascii_lowercase
5+
n = int(input())
6+
ans = ''
7+
ind = 0
8+
while ind<n:
9+
ans += chars[ind%26]
10+
ind += 1
11+
print (ans)

‎HackerRank/Loops.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Enter your code here. Read input from STDIN. Print output to STDOUT
2+
n = int(input())
3+
for i in range (0,n):
4+
print (i*i)

‎Loop.py

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
for i in range(10):
2+
print(i,end=' ')
3+
print()
4+
'''
5+
Output:
6+
0 1 2 3 4 5 6 7 8 9
7+
'''
8+
9+
for i in range(10, 0, -1):
10+
print(i, end=' ')
11+
print()
12+
'''
13+
Output:
14+
10 9 8 7 6 5 4 3 2 1
15+
'''
16+
17+
for i in reversed(range(10)):
18+
print(i, end=' ')
19+
print()
20+
'''
21+
Output:
22+
9 8 7 6 5 4 3 2 1 0
23+
'''
24+
25+
i = 10
26+
while i != 0:
27+
print(i, end=' ')
28+
i -= 1
29+
print()
30+
'''
31+
Output:
32+
10 9 8 7 6 5 4 3 2 1
33+
'''
34+
35+
36+
# 1 + 2 + 3 + ....... + n
37+
### for loop
38+
n = int(input())
39+
sm = 0
40+
for i in range(1, n + 1):
41+
sm += i
42+
43+
print(sm)
44+
'''
45+
Input:
46+
100
47+
48+
Output:
49+
5050
50+
'''
51+
52+
### while loop
53+
n = int(input())
54+
i = 0
55+
sm = 0
56+
while i <= n:
57+
sm += i
58+
i += 1
59+
print(sm)
60+
61+
62+
# Counts how many 2 divides 100
63+
x = 100
64+
cnt = 0
65+
while x%2 == 0:
66+
x = x//2
67+
cnt += 1
68+
print(cnt)
69+
'''
70+
Output:
71+
2
72+
'''
73+
74+
#### Finds out the highest number which is power of 2 and less than 1000
75+
x = 1
76+
# if multiplying by 2 does not exceed 1000, multiply
77+
while x*2 < 1000:
78+
x *= 2
79+
print(x)
80+
81+
82+
#### prints odd numbers 1 to 10
83+
for i in range(1, 10 + 1):
84+
if i % 2 == 0: continue
85+
print(i, end= ' ')
86+
print()
87+
88+
### Print only 1,2,3
89+
for i in range(1, 11):
90+
if i > 3:
91+
break
92+
print(i, end=' ')
93+
print()
94+
95+
96+
97+
##### 1 + (1+2) + (1+2+3) + .... + (1+2+3+..+n)
98+
n = int(input())
99+
sm = 0
100+
for i in range(1, n+1):
101+
for j in range(1, i):
102+
sm += j
103+
print(sm)
104+
105+
106+
### Simple function for problem solving
107+
108+
def Main(): # user define function
109+
n = int(input())
110+
# now we will calculate the factorial of a number
111+
fact = 1
112+
for i in range(1, n + 1):
113+
fact *= i
114+
115+
print(fact)
116+
117+
118+
if __name__ == '__main__': # python3 'main' function
119+
Main() # call the user define function 'Main()'
120+
121+
###########
122+
123+
### EOF
124+
125+
while True:
126+
try:
127+
a = input()
128+
print(a)
129+
except EOFError:
130+
break
131+
132+
133+
134+
135+
136+
'''
137+
** You are now able to solve following online-judge problems.
138+
------------------------------------------------------------
139+
(1) URI Online Judge | 1103 Alarm Clock
140+
(2) Timus | 1083. Factorials!!!
141+
(3) Timus | 1209. 1, 10, 100, 1000...
142+
(4) URI Online Judge | 1161 Factorial Sum
143+
(5) URI Online Judge | 1059 Even Numbers
144+
(6) HackerRank | Loops
145+
(7) Spoj | TEST - Life, the Universe, and Everything
146+
(8) CodeChef | Life, the Universe, and Everything
147+
(9) CodeChef | N different palindromes
148+
(10) UVa | 10055 Hashmat the Brave Warrior
149+
'''
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
n = int(input())
2+
while n != 42:
3+
print(n)
4+
n = int(input())

‎Timus/1083. Factorials!!!.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
def Main():
2+
n, s = map(str, input().split())
3+
ln = len(s)
4+
fact = 1
5+
n = int(n)
6+
for i in range(n, 1, -ln):
7+
fact *= i
8+
print(fact)
9+
10+
if __name__ == '__main__':
11+
Main()

‎Timus/1209. 1, 10, 100, 1000....py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import math
2+
T = int(input())
3+
while T != 0:
4+
k = int(input())
5+
t = int(math.sqrt((k-1)*2))
6+
7+
if (t*(t+1)//2 + 1) == k:
8+
print(1, end=' ')
9+
else:
10+
print(0, end=' ')
11+
12+
T -= 1
13+
14+
# Vertict TLE

‎URI/1059 Even Numbers.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# -*- coding: utf-8 -*-
2+
3+
'''
4+
Escreva a sua solução aqui
5+
Code your solution here
6+
Escriba su solución aquí
7+
'''
8+
'''
9+
Created on Aug 16, 2016
10+
11+
@author: Md. Rezwanul Haque
12+
'''
13+
for _ in range(2,102,2):
14+
print(_)

‎URI/1161 Factorial Sum.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
'''
3+
Escreva a sua solução aqui
4+
Code your solution here
5+
Escriba su solución aquí
6+
'''
7+
8+
'''
9+
Created on Aug 9, 2016
10+
11+
@author: Md. Rezwanul Haque
12+
'''
13+
def Fact(n):
14+
if n == 0 or n == 0: return 1
15+
return n*Fact(n-1)
16+
17+
while True:
18+
try:
19+
a, b = map(int, input().split())
20+
S = Fact(a) + Fact(b)
21+
print(S)
22+
except EOFError:
23+
break

‎UVa/10055 Hashmat the Brave Warrior.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'''
2+
Created on Jul 28, 2016
3+
@author: Md. Rezwanul Haque
4+
'''
5+
while(True):
6+
try:
7+
x, y = map(int,input().split())
8+
print(abs(x-y))
9+
except EOFError:
10+
break

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /