Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CP/Python/Beautiful_Year.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#https://codeforces.com/problemset/problem/271/A

a=int(input())

for i in range(a+1,9999):
s=str(i)
b=set(s)
if len(b)==len(s):
print(i)
break
else:
continue

'''
Sample input:
1987
output:
2013
'''
21 changes: 21 additions & 0 deletions CP/Python/Full_House.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#https://atcoder.jp/contests/abc263/tasks/abc263_a

n=5
arr=list(map(int,input().split()))
brr=set(arr)
if len(brr)==2 and (arr.count(arr[0])==2 or arr.count(arr[0])==3 ):
print("Yes")
else:
print("No")

'''
sample input1:
1 1 1 2 2
output:
Yes

sample input2:
1 2 3 1 1
ouput:
No
'''
16 changes: 16 additions & 0 deletions CP/Python/In_search_of_an_easy_problem.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#https://codeforces.com/problemset/problem/1030/A

n=int(input())
arr=list(map(int,input().split()))
if sum(arr)==0:
print("EASY")
else:
print("HARD")

'''
sample input:
3
0 0 1
output:
HARD
'''
23 changes: 23 additions & 0 deletions CP/Python/When.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#https://atcoder.jp/contests/abc258/tasks/abc258_a

h=21
m=0
k=int(input())
if k>=60:
h+=1
m+=(k-60)
else:
m+=k
ans=""
if m<10:
ans=str(h)+":0"+str(m)
else:
ans=str(h)+":"+str(m)
print(ans)

'''
sample input:
63
output:
22:03
'''
30 changes: 30 additions & 0 deletions CP/Python/fair_playoff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#https://codeforces.com/problemset/problem/1535/A
t=int(input())
for i in range(t):
arr=list(map(int,input().split()))
n=len(arr)
max1=max(arr[0],arr[1])
max2=max(arr[2],arr[3])
arr.sort()
m1=arr[n-1]
m2=arr[n-2]
if (max1==m1 or max1==m2) and (max2==m1 or max2==m2):
print("YES")
else:
print("NO")

'''
sample input1:
4
4
3 7 9 5
4 5 6 9
5 3 8 1
6 5 3 2

ouput1:
YES
NO
YES
NO
'''
27 changes: 27 additions & 0 deletions CP/Python/holiday_of_equality.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#https://codeforces.com/problemset/problem/758/A

n=int(input())
arr=list(map(int,input().split()))
if n==1:
print(0)
else:
sumof=0
arr.sort()
max=arr[n-1]
for i in range(n-1):
sumof+=max-arr[i]
print(sumof)

'''
sample input1:
5
0 1 2 3 4
output1:
10

sample input2:
3
1 3 1
output2:
4
'''
40 changes: 40 additions & 0 deletions CP/Python/number_groups.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#https://www.hackerrank.com/challenges/number-groups/problem

import math
import os
import random
import re
import sys

def sumOfGroup(k):
# Return the sum of the elements of the k'th group.
n=k+(k-1)**2
endval=n+(k+(k-1))

sumodd=0

for i in range(n,endval,2):
sumodd+=i
return sumodd

if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')

k = int(input().strip())

answer = sumOfGroup(k)

fptr.write(str(answer) + '\n')

fptr.close()
'''
sample input1:
3
output:
27

sample input2:
4
sample output:
64
'''