Skip to content

Commit

Permalink
cpp files updated, removed ### in some questions, add questions, remo…
Browse files Browse the repository at this point in the history
…ved unsolved
  • Loading branch information
bestmahdi2 committed Feb 28, 2022
1 parent 1004520 commit 417cf13
Show file tree
Hide file tree
Showing 66 changed files with 676 additions and 225 deletions.
232 changes: 119 additions & 113 deletions README.md

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions Solved/Adaade Fisaghooresi/Adaade Fisaghooresi.Py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ if a ** 2 == b ** 2 + c ** 2 or b ** 2 == a ** 2 + c ** 2 or c ** 2 == b ** 2 +
print("YES")
else:
print("NO")

###########################################################
31 changes: 31 additions & 0 deletions Solved/Alpha Centauri/Alpha Centauri.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# آلفا قنطورس
# ID : 66859
# https://quera.org/problemset/66859/
# https://b2n.ir/d99346


def NumberToChar(number):
if 0 <= number <= 9:
return chr(ord('0') + number)

else:
return chr(ord('A') + number - 10)


def baseConverter(keeper, number, base):
if base == 10:
return str(number)

else:
while True:
if number > 0:
keeper += NumberToChar(number % base)
number = int(number / base)
else:
break

return keeper[::-1]


n, b = input().split(" ")
print(baseConverter(keeper="", number=int(n), base=int(b)))
Binary file not shown.
2 changes: 0 additions & 2 deletions Solved/Asemane Shekar Abad/Asemane Shekar Abad.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@
for i in range(int(input().split()[0])):
starts += (input()).count("*")
print(starts)

###########################################################
24 changes: 22 additions & 2 deletions Solved/Aval Bini/Aval Bini.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

lst = []

for x in range(s+1, e):
for x in range(s + 1, e):
flag = False
for y in range(2, x//2+1):
for y in range(2, x // 2 + 1):
if x % y == 0:
flag = True
break
Expand All @@ -36,4 +36,24 @@

print(*lst, sep=",")


###########################################################

def isPrime(number):
for j in range(2, number):
if number % j == 0:
return False
return True


a, b = int(input()), int(input())

result = []

for number in range(a + 1, b):
count = 0

if isPrime(number):
result.append(str(number))

print(",".join(result))
12 changes: 12 additions & 0 deletions Solved/Badkhahe Mardom/Badkhahe Mardom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# بدخواه مردم
# ID : 2706
# https://quera.org/problemset/2706/
# https://b2n.ir/z93074

m, n = map(int, input().split())

if m % 2 == 0:
print("white")

else:
print("black")
Binary file not shown.
32 changes: 21 additions & 11 deletions Solved/Bmm-Kmm/Bmm-Kmm.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
#include <iostream>

using namespace std;
int main()
{
int a,b,c,d,e;
cin>>a>>b;
d=a;
e=b;
while(b>0){
c=a%b;
a=b;
b=c;

int main() {
int n, m, n1, m1, b;
cin >> n >> m;
if (n > m){
int temp = m;
m = n;
n = temp;
}
cout<<a<<" "<<(d*e)/a<<endl;

n1 = n;
m1 = m;

while (m > 0) {
b = n % m;
n = m;
m = b;
}

cout << n << " " << (n1 * m1) / n;
return 0;
}
1 change: 0 additions & 1 deletion Solved/Bmm-Kmm/Bmm-Kmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

n1, m1 = n, m
while m > 0:
print(m, n)
b = n % m
n = m
m = b
Expand Down
3 changes: 3 additions & 0 deletions Solved/Chape Baraks/Chape Baraks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
# https://b2n.ir/637768

lister = []

while True:
number = input()
if number == "0":
break

lister.append(number)

for i in lister[::-1]:
print(i)
2 changes: 0 additions & 2 deletions Solved/Chape Moraba'/Chape Moraba'.Py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@
n = int(input())
between = ("*" + " " * (n - 2) + "*\n") * (n - 2)
print("*" * n, between + "*" * n, sep="\n")

###########################################################
2 changes: 0 additions & 2 deletions Solved/Class Code !/Class Code !.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@
keeper = keeper + str(i)

print(keeper[k - 1])

###########################################################
37 changes: 37 additions & 0 deletions Solved/Code Master/Code Master.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,43 @@
# https://b2n.ir/t11531


def reVal(number):
if 0 <= number <= 9:
return chr(number + ord('0'))
else:
return chr(number - 10 + ord('A'))


def baseConvert(result, input_num, base):
if base != 10:
while input_num > 0:
result += reVal(input_num % base)
input_num = int(input_num / base)
return result[::-1]

return str(input_num)


n, k = [int(i) for i in input().split(" ")]
temp_khafan = 0
number = 2

while temp_khafan <= n:
for j in range(2, number):
if number % j == 0:
break
else:
changedBase = baseConvert("", input_num=number, base=k)
if changedBase == changedBase[::-1]:
temp_khafan += 1
if temp_khafan == n:
break
number += 1

print(number)

###########################################################

n, k = [int(i) for i in input().split()]

dics = {
Expand Down
1 change: 1 addition & 0 deletions Solved/Doorbin MadarBaste/Doorbin MadarBaste.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
d1 = [i for i in set(d1) if d1.count(i) == 1]
d2 = [a[1], b[1], c[1]]
d2 = [i for i in set(d2) if d2.count(i) == 1]

print(d1[0], d2[0])
2 changes: 1 addition & 1 deletion Solved/EmSin/EmSin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
for i in range(number):
print(lister[i])

###############################
###########################################################

m = int(input())
for x in range(m):
Expand Down
17 changes: 9 additions & 8 deletions Solved/Factorial/Factorial.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#include <iostream>

using namespace std;
int main(){
int n,fact;
fact=1;

int main() {
int n, fact;
fact = 1;
cin >> n;

while (n>0)
{
fact = fact*n;
n=n-1;
while (n > 0) {
fact = fact * n;
n = n - 1;
}
cout<<fact<<endl;
cout << fact << endl;
return 0;
}
21 changes: 21 additions & 0 deletions Solved/Farzad Karkon/Farzad Karkon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# فرزاد کارکن
# ID : 658
# https://quera.org/problemset/658/
# https://b2n.ir/m57632

import numpy

a = int(input())
b = [int(t) for t in input().split()]

if max(b) <= 0:
print(0)

else:
h = [max(b)]

for i in range(2, a):
for j in range(0, (a - (i)) + 1):
h.append(numpy.sum([b[k] for k in range(j, j + i)]))

print(max(h))
Binary file not shown.
70 changes: 70 additions & 0 deletions Solved/Hame Zir Majooe Ha/Hame Zir Majmooe Ha.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# همه ی زیرمجموعه ها
# ID : 12912
# https://quera.org/problemset/12912/
# https://b2n.ir/e36183

from collections import deque

h = []

def printPowerSet(S, i, out=deque()):
if i < 0:
po = list(out)
po.sort()
h.append(po)
return

out.append(S[i])
printPowerSet(S, i - 1, out)
out.pop()

while i > 0 and S[i] == S[i - 1]:
i = i - 1

printPowerSet(S, i - 1, out)


def findPowerSet(S):
S.sort()
printPowerSet(S, len(S) - 1)


haaayyyyy = int(input())
s = [int(u) for u in range(1, haaayyyyy + 1)]
printPowerSet(s, haaayyyyy - 1)
h.sort()

for k in h:
st = str(k)
st = st.replace("[", "{")
st = st.replace("]", "}")
print(st)

###########################################################

def sebSequence(number, step, keep, continuee):
if step > number:
return

if continuee:
printer(keep)

keep.append(step + 1)
sebSequence(number, step + 1, keep, True)

keep.pop()
sebSequence(number, step + 1, keep, False)


def printer(keep):
temp = []
for i in range(len(keep)):
temp.append(keep[i])

text = '{' + f'{", ".join([str(i) for i in temp])}' + '}'
print(text)


number = int(input())
keep = []
sebSequence(number, 0, keep, True)
Binary file not shown.
Loading

2 comments on commit 417cf13

@mehanalavimajd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect

@bestmahdi2
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect

😁🌺

Please sign in to comment.