diff --git a/CP/Python/Beautiful_Year.py b/CP/Python/Beautiful_Year.py new file mode 100644 index 0000000..04230e4 --- /dev/null +++ b/CP/Python/Beautiful_Year.py @@ -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 +''' diff --git a/CP/Python/Full_House.py b/CP/Python/Full_House.py new file mode 100644 index 0000000..a40cf90 --- /dev/null +++ b/CP/Python/Full_House.py @@ -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 +''' diff --git a/CP/Python/In_search_of_an_easy_problem.py b/CP/Python/In_search_of_an_easy_problem.py new file mode 100644 index 0000000..0a68f20 --- /dev/null +++ b/CP/Python/In_search_of_an_easy_problem.py @@ -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 +''' diff --git a/CP/Python/When.py b/CP/Python/When.py new file mode 100644 index 0000000..d6d9701 --- /dev/null +++ b/CP/Python/When.py @@ -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 +''' diff --git a/CP/Python/fair_playoff.py b/CP/Python/fair_playoff.py new file mode 100644 index 0000000..45b5d0d --- /dev/null +++ b/CP/Python/fair_playoff.py @@ -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 +''' diff --git a/CP/Python/holiday_of_equality.py b/CP/Python/holiday_of_equality.py new file mode 100644 index 0000000..c2ca97f --- /dev/null +++ b/CP/Python/holiday_of_equality.py @@ -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 +''' diff --git a/CP/Python/number_groups.py b/CP/Python/number_groups.py new file mode 100644 index 0000000..4fe7027 --- /dev/null +++ b/CP/Python/number_groups.py @@ -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 +'''