Movatterモバイル変換


[0]ホーム

URL:


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

Commit8716772

Browse files
committed
save tmp
1 parent7c35923 commit8716772

8 files changed

+60
-0
lines changed

‎1/1.pyrenamed to‎1/1_time.py

File renamed without changes.
File renamed without changes.

‎7/5MySol.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
N=5# 기계부품
2+
nums= [8,3,7,9,2]# 부품번호
3+
M=3# 확인개수
4+
chks= [3,7,9]# 부품번호
5+
6+
foriinchks:
7+
ifiinnums:
8+
print('yes')
9+
else:
10+
print('no')

‎7/5_2진탐색.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
N=5# 기계부품
2+
nums= [8,3,7,9,2]# 부품번호
3+
M=3# 확인개수
4+
chks= [5,7,9]# 부품번호
5+
nums.sort()
6+
chks.sort()
7+
8+
9+
defbinary_search(array,target,start,end):
10+
whilestart<=end:
11+
mid= (start+end)//2
12+
ifarray[mid]==target:
13+
returnmid
14+
elifarray[mid]>target:
15+
end=mid-1
16+
else:
17+
start=mid+1
18+
returnNone
19+
20+
foriinchks:
21+
result=binary_search(nums,i ,0,N-1)
22+
ifresult!=None:
23+
print('yes')
24+
else:
25+
print('no')

‎basic/counter_lib.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fromcollectionsimportCounter
2+
list= ['red','blue','red','green','blue','blue']
3+
print(dict(Counter(list)))
4+
print(Counter(list)['blue'])
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
fromitertoolsimportpermutations,combinations,product,combinations_with_replacement
2+
data= ['A','B','C']
3+
순열=list(permutations(data,2))
4+
조합=list(combinations(data,2))
5+
중복순열=list(product(data,repeat=2))
6+
중복조합=list(combinations_with_replacement(data,2))
7+
print(순열,조합,중복순열,중복조합,sep='\n')

‎basic/자료형.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# 자료형 초기화
2+
list_= [1,2,3]
3+
tuple_= (1,2,3)
4+
dict_= {'one':1,'two':2,'three':3}# 순서없음, O(1)
5+
set_= {1,2,3}# 중복불가, 순서없음, O(1)
6+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
importmath
2+
3+
print(math.gcd(21,14))
4+
5+
deflcm(a,b):
6+
return (a*b)//math.gcd(a,b)
7+
8+
print(lcm(21,14))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp