diff --git "a/PY01004 - NGUY\303\212N T\341\273\220.py" "b/PY01004 - NGUY\303\212N T\341\273\220.py" new file mode 100644 index 0000000..4f62e06 --- /dev/null +++ "b/PY01004 - NGUY\303\212N T\341\273\220.py" @@ -0,0 +1,17 @@ +from math import gcd +from math import sqrt + +def prime(n): + if n < 2: return False + for i in range(2,int(sqrt(n))+1): + if n%i == 0: return False + return True + +test = int(input()) +for i in range(test): + k = 0 + n = int(input()) + for i in range(n): + if gcd(n,i) == 1: k=k+1 + if(prime(k)): print("YES") + else: print("NO") diff --git "a/PY01005 - S\341\273\220 MAY M\341\272\256N.py" "b/PY01005 - S\341\273\220 MAY M\341\272\256N.py" new file mode 100644 index 0000000..ba3695b --- /dev/null +++ "b/PY01005 - S\341\273\220 MAY M\341\272\256N.py" @@ -0,0 +1,6 @@ +n = input() +cnt = 0 +for i in n: + if i=='4' or i == '7': cnt = cnt+1 +if cnt == 4 or cnt == 7: print("YES") +else: print("NO") diff --git "a/PY01006 - S\341\273\220 MAY M\341\272\256N - 2.py" "b/PY01006 - S\341\273\220 MAY M\341\272\256N - 2.py" new file mode 100644 index 0000000..74de6da --- /dev/null +++ "b/PY01006 - S\341\273\220 MAY M\341\272\256N - 2.py" @@ -0,0 +1,9 @@ +def lucky(n): + for i in n: + if i != '4' and i != '7': return "NO" + return "YES" +test = int(input()) +for i in range(test): + n = input() + print(lucky(n)) + diff --git "a/PY01007 - L\303\203I SU\341\272\244T NG\303\202N H\303\200NG.py" "b/PY01007 - L\303\203I SU\341\272\244T NG\303\202N H\303\200NG.py" new file mode 100644 index 0000000..d41f839 --- /dev/null +++ "b/PY01007 - L\303\203I SU\341\272\244T NG\303\202N H\303\200NG.py" @@ -0,0 +1,5 @@ +from math import log +test = int(input()) +for i in range(test): + n,x,m = [ float(x) for x in input().split() ] + print(int(log( m/n, 1 + x/100 )) + 1 ) diff --git "a/PY01008 - CHUY\341\273\202N TH\303\200NH CH\341\273\256 HOA.py" "b/PY01008 - CHUY\341\273\202N TH\303\200NH CH\341\273\256 HOA.py" new file mode 100644 index 0000000..2fa06ff --- /dev/null +++ "b/PY01008 - CHUY\341\273\202N TH\303\200NH CH\341\273\256 HOA.py" @@ -0,0 +1,2 @@ +s = input() +print(s.upper()) diff --git "a/PY01009 - CH\341\273\256 HOA \342\200\223 CH\341\273\256 TH\306\257\341\273\234NG.py" "b/PY01009 - CH\341\273\256 HOA \342\200\223 CH\341\273\256 TH\306\257\341\273\234NG.py" new file mode 100644 index 0000000..27a2893 --- /dev/null +++ "b/PY01009 - CH\341\273\256 HOA \342\200\223 CH\341\273\256 TH\306\257\341\273\234NG.py" @@ -0,0 +1,8 @@ +s = input() +hoa = 0 +thuong = 0 +for i in s: + if i <= 'z' and i >= 'a': thuong +=1 + else: hoa +=1 +if hoa > thuong: print(s.upper()) +else: print(s.lower()) \ No newline at end of file diff --git "a/PY01010 - \304\220\341\272\246U CU\341\273\220I.py" "b/PY01010 - \304\220\341\272\246U CU\341\273\220I.py" new file mode 100644 index 0000000..38f480c --- /dev/null +++ "b/PY01010 - \304\220\341\272\246U CU\341\273\220I.py" @@ -0,0 +1,8 @@ +def check(n): + if(n[0]==n[-2] and n[1]==n[-1]): return "YES" + return "NO" +test = int(input()) +for i in range(test): + s = input() + print(check(s)) + diff --git "a/PY01013 - \306\257\341\273\232C S\341\273\220 CHUNG NGUY\303\212N T\341\273\220.py" "b/PY01013 - \306\257\341\273\232C S\341\273\220 CHUNG NGUY\303\212N T\341\273\220.py" new file mode 100644 index 0000000..be277fa --- /dev/null +++ "b/PY01013 - \306\257\341\273\232C S\341\273\220 CHUNG NGUY\303\212N T\341\273\220.py" @@ -0,0 +1,18 @@ +from math import gcd +from math import sqrt +def phan_tich(x): + tong = 0 + while x != 0: + tong += x%10 + x = int(x/10) + return tong +def prime(x): + if x < 2: return "NO" + else: + for i in range(2,int(sqrt(x))+1): + if x%i == 0: return "NO" + return "YES" +t = int(input()) +for _ in range(t): + x,y = [int(a) for a in input().split()] + print(prime(phan_tich(gcd(x,y)))) diff --git "a/PY01014 - CHIA H\341\272\276T CHO K.py" "b/PY01014 - CHIA H\341\272\276T CHO K.py" new file mode 100644 index 0000000..2e97d21 --- /dev/null +++ "b/PY01014 - CHIA H\341\272\276T CHO K.py" @@ -0,0 +1,9 @@ +a,k,n = [int(x) for x in input().split()] +i = 1 +ok = 1 +while k*i <=n: + if k*i - a > 0 : + ok = 0 + print(k*i - a,end = ' ') + i+=1 +if ok: print(-1) diff --git "a/PY01015 - S\341\273\220 KH\303\224NG GI\341\272\242M.py" "b/PY01015 - S\341\273\220 KH\303\224NG GI\341\272\242M.py" new file mode 100644 index 0000000..bf07532 --- /dev/null +++ "b/PY01015 - S\341\273\220 KH\303\224NG GI\341\272\242M.py" @@ -0,0 +1,8 @@ +t = int(input()) +def check(s): + for i in range(len(s) - 1): + if s[i] > s[i+1]: return "NO" + return "YES" +for i in range(t): + s = input() + print(check(s)) diff --git "a/PY01016 - GI\341\272\242I M\303\203.py" "b/PY01016 - GI\341\272\242I M\303\203.py" new file mode 100644 index 0000000..06d11a3 --- /dev/null +++ "b/PY01016 - GI\341\272\242I M\303\203.py" @@ -0,0 +1,6 @@ +t = int(input()) +for _ in range(t): + s = input() + for i in range(len(s)-1): + if i%2 == 0: print(s[i]*int(s[i+1]),end='') + print() \ No newline at end of file diff --git "a/PY01017 - M\303\203 H\303\223A 1.py" "b/PY01017 - M\303\203 H\303\223A 1.py" new file mode 100644 index 0000000..9c4776b --- /dev/null +++ "b/PY01017 - M\303\203 H\303\223A 1.py" @@ -0,0 +1,13 @@ +t = int(input()) +for _ in range(t): + s = input() + cnt = 1 + for i in range(len(s)-1): + if s[i] == s[i+1]: + cnt +=1 + else: + print(cnt,end='') + print(s[i],end='') + cnt = 1 + print(cnt,end='') + print(s[-1]) \ No newline at end of file diff --git "a/PY01019 - KHO\341\272\242NG C\303\201CH K\303\235 T\341\273\260.py" "b/PY01019 - KHO\341\272\242NG C\303\201CH K\303\235 T\341\273\260.py" new file mode 100644 index 0000000..18c6776 --- /dev/null +++ "b/PY01019 - KHO\341\272\242NG C\303\201CH K\303\235 T\341\273\260.py" @@ -0,0 +1,9 @@ +t = int(input()) +def check(s): + a = s[::-1] + for i in range(1,len(s)): + if abs(ord(s[i])-ord(s[i-1])) != abs(ord(a[i])-ord(a[i-1])): return "NO" + return "YES" +for _ in range(t): + s = input() + print(check(s)) diff --git "a/PY01020 - S\341\273\220 PH\303\201T L\341\273\230C.py" "b/PY01020 - S\341\273\220 PH\303\201T L\341\273\230C.py" new file mode 100644 index 0000000..6944ce9 --- /dev/null +++ "b/PY01020 - S\341\273\220 PH\303\201T L\341\273\230C.py" @@ -0,0 +1,8 @@ +def check(s): + if len(s) < 2: return "NO" + if s[-1] == '6' and s[-2] == '8': return "YES" + return "NO" +t = int(input()) +for _ in range(t): + s = input() + print(check(s)) diff --git "a/PY01024 - CH\341\272\264N - L\341\272\272.py" "b/PY01024 - CH\341\272\264N - L\341\272\272.py" new file mode 100644 index 0000000..f0cccdc --- /dev/null +++ "b/PY01024 - CH\341\272\264N - L\341\272\272.py" @@ -0,0 +1,16 @@ +def check1(s): + tong = 0 + for i in s: + tong += int(i) + if tong%10 == 0: return True + return False + +def check2(s): + for i in range(len(s)-1): + if abs(int(s[i])-int(s[i+1])) !=2: return False + return True +t = int(input()) +for _ in range(t): + s = input() + if check1(s) and check2(s): print("YES") + else: print("NO") diff --git "a/PY01028 - T\303\201CH T\341\273\252.py" "b/PY01028 - T\303\201CH T\341\273\252.py" new file mode 100644 index 0000000..33371c8 --- /dev/null +++ "b/PY01028 - T\303\201CH T\341\273\252.py" @@ -0,0 +1,2 @@ +for i in input().split(): + print(i) diff --git "a/PY01029 - S\341\273\220 \304\220\341\272\242O NGUY\303\212N T\341\273\220 C\303\231NG NHAU.py" "b/PY01029 - S\341\273\220 \304\220\341\272\242O NGUY\303\212N T\341\273\220 C\303\231NG NHAU.py" new file mode 100644 index 0000000..003ff97 --- /dev/null +++ "b/PY01029 - S\341\273\220 \304\220\341\272\242O NGUY\303\212N T\341\273\220 C\303\231NG NHAU.py" @@ -0,0 +1,7 @@ +from math import gcd +t = int(input()) +for i in range(t): + s = input() + s1 = s[::-1] + if gcd(int(s),int(s1)) == 1: print("YES") + else: print("NO") diff --git "a/PY01030 - NGUY\303\212N T\341\273\220 C\303\231NG NHAU.py" "b/PY01030 - NGUY\303\212N T\341\273\220 C\303\231NG NHAU.py" new file mode 100644 index 0000000..d92e2c6 --- /dev/null +++ "b/PY01030 - NGUY\303\212N T\341\273\220 C\303\231NG NHAU.py" @@ -0,0 +1,8 @@ +from math import gcd +n,k = [int(x) for x in input().split()] +cnt = 0 +for i in range(10**(k-1),10**k): + if gcd(n,i) ==1: + print(i,end =' ') + cnt +=1 + if cnt %10 == 0: print() diff --git "a/PY01036 - T\303\215NH T\341\273\224NG PH\303\202N TH\341\273\250C.py" "b/PY01036 - T\303\215NH T\341\273\224NG PH\303\202N TH\341\273\250C.py" new file mode 100644 index 0000000..5275a19 --- /dev/null +++ "b/PY01036 - T\303\215NH T\341\273\224NG PH\303\202N TH\341\273\250C.py" @@ -0,0 +1,9 @@ +t = int(input()) +for i in range(t): + a = int(input()) + s = 0 + k = 1 + if a % 2 == 0: k = 2 + for i in range(k,a+1,2): + s += 1/i + print("{:.6f}".format(s)) diff --git "a/PY01038 - KI\341\273\202M TRA CHIA H\341\272\276T CHO 7.py" "b/PY01038 - KI\341\273\202M TRA CHIA H\341\272\276T CHO 7.py" new file mode 100644 index 0000000..c0b12dd --- /dev/null +++ "b/PY01038 - KI\341\273\202M TRA CHIA H\341\272\276T CHO 7.py" @@ -0,0 +1,9 @@ +t = int(input()) +for i in range(t): + n = input() + while int(n) % 7 != 0: + n1 = str(n)[::-1] + n = int(n) + int (n1) + n = str(n) + print(n) + diff --git "a/PY01039 - KI\341\273\202M TRA S\341\273\220 \304\220\341\272\270P.py" "b/PY01039 - KI\341\273\202M TRA S\341\273\220 \304\220\341\272\270P.py" new file mode 100644 index 0000000..2198717 --- /dev/null +++ "b/PY01039 - KI\341\273\202M TRA S\341\273\220 \304\220\341\272\270P.py" @@ -0,0 +1,20 @@ +def check(n): + a = n[0] + b = n[1] + if a == b: return "NO" + if len(n) % 2 == 0: + for i in range(2,len(n)-1,2): + if n[i] != a: return "NO" + for i in range(3,len(n),2): + if n[i] != b: return "NO" + else: + for i in range(2,len(n),2): + if n[i] != a: return "NO" + for i in range(3,len(n)-1,2): + if n[i] != b: return "NO" + return "YES" + +test = int(input()) +for i in range(test): + n = input() + print(check(n)) \ No newline at end of file diff --git "a/PY01042 - KI\341\273\202M TRA H\341\273\206 C\306\240 S\341\273\220 3.py" "b/PY01042 - KI\341\273\202M TRA H\341\273\206 C\306\240 S\341\273\220 3.py" new file mode 100644 index 0000000..48becb6 --- /dev/null +++ "b/PY01042 - KI\341\273\202M TRA H\341\273\206 C\306\240 S\341\273\220 3.py" @@ -0,0 +1,8 @@ +def check(s): + for i in s: + if i > '3' or i < '0': return "NO" + return "YES" +test = int(input()) +for i in range(test): + s = input() + print(check(s)) \ No newline at end of file diff --git "a/PY01045 - X\303\202U PALINDROME.py" "b/PY01045 - X\303\202U PALINDROME.py" new file mode 100644 index 0000000..c0ba4d8 --- /dev/null +++ "b/PY01045 - X\303\202U PALINDROME.py" @@ -0,0 +1,2 @@ +s = input() +print(len(s)-1) \ No newline at end of file diff --git "a/PY01047 - KI\341\273\202M TRA NGUY\303\212N T\341\273\220.py" "b/PY01047 - KI\341\273\202M TRA NGUY\303\212N T\341\273\220.py" new file mode 100644 index 0000000..e7f0ae9 --- /dev/null +++ "b/PY01047 - KI\341\273\202M TRA NGUY\303\212N T\341\273\220.py" @@ -0,0 +1,13 @@ +from math import sqrt +def prime(s): + if s < 2 : return False + for i in range(2,int(sqrt(s))+1): + if s % i == 0: return False + return True +t = int(input()) +for i in range(t): + s = input() + a ="" + a += s[-4] + s[-3] + s[-2] + s[-1] + if prime(int(a)): print("YES") + else: print("NO") diff --git "a/PY01049 - CH\341\273\256 S\341\273\220 NGUY\303\212N T\341\273\220.py" "b/PY01049 - CH\341\273\256 S\341\273\220 NGUY\303\212N T\341\273\220.py" new file mode 100644 index 0000000..473f296 --- /dev/null +++ "b/PY01049 - CH\341\273\256 S\341\273\220 NGUY\303\212N T\341\273\220.py" @@ -0,0 +1,20 @@ +from math import sqrt +def prime(s): + if s < 2 : return False + for i in range(2,int(sqrt(s))+1): + if s % i == 0: return False + return True +def check1(s): + if prime(len(s)): return True + return False +def check2(s): + cnt = 0 + for i in s: + if prime(int(i)): cnt += 1 + if cnt > len(s) - cnt: return True + return False +t = int(input()) +for i in range(t): + s = input() + if check1(s) and check2(s): print("YES") + else: print("NO") \ No newline at end of file diff --git "a/PY01053 - S\341\273\220 CHIA H\341\272\276T CHO 3.py" "b/PY01053 - S\341\273\220 CHIA H\341\272\276T CHO 3.py" new file mode 100644 index 0000000..892e31c --- /dev/null +++ "b/PY01053 - S\341\273\220 CHIA H\341\272\276T CHO 3.py" @@ -0,0 +1,5 @@ +t = int(input()) +for i in range(t): + a = int(input()) + if a % 3 == 0: print("YES") + else: print("NO")