๋ฐ์ํ
Notice
Recent Posts
Recent Comments
Link
| ์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
| 29 | 30 | 31 |
Tags
- ์ธํผ
- ์ฝ๋ฉํ ์คํธ
- ์คํ
- DP
- ์๋ฐ์คํฌ๋ฆฝํธ
- ์นด์นด์ค
- ๋ค์ด๋๋ฏนํ๋ก๊ทธ๋๋ฐ
- SSAFY
- BFS
- ์ฝํ
- ๋ฐฑ์ค
- Backjoon
- ํ์ด์ฌ
- algorithm
- DFS
- ์์ ํ์
- SW์ญ๋ํ ์คํธ
- ๊ทธ๋ํ
- boj
- ํ๋ก๊ทธ๋๋จธ์ค
- Python
- Blind
- sort
- ํํ
- kakao
- javascript
- ์ผ์ฑ
- ์๊ณ ๋ฆฌ์ฆ
- ์๋ฃ๊ตฌ์กฐ
- SWEA
Archives
- Today
- Total
๋ง์ํ
[python] pow, ์ ๊ณฑ, ๊ฑฐ๋ญ์ ๊ณฑ๊ณผ ๋๋จธ์ง ๋ณธ๋ฌธ
Programming language/Python
[python] pow, ์ ๊ณฑ, ๊ฑฐ๋ญ์ ๊ณฑ๊ณผ ๋๋จธ์ง
deo2kim 2020. 8. 28. 20:06๋ฐ์ํ

๐ ํ์ด์ฌ์์ ๊ฑฐ๋ญ์ ๊ณฑ๊ณผ ๋๋จธ์ง๋ฅผ ๊ตฌํ ๋! ์๋ ์ฐจ์ด
๐ต pow(a,b) vs a**b
100์ 100์น์ ๊ตฌํ ๋
| ์ ๋ ฅ ๋ฐฉ๋ฒ | ์๋ |
| 100**100 | 0.8038559000000001 |
| pow(100, 100) | 0.8454946999999997 |
- ๊ฑฐ๋ญ์ ๊ณฑ์ ํ์ ๋๋ ** ์ ์ฐ๋๊ฒ์ด ์กฐ๊ธ ๋ ๋น ๋ฅด๋ค.
ํ์ง๋ง!!
๐ต pow(a,b,c) vs a**b%c
100์ 100์น์ 100์ผ๋ก ๋๋ ๋๋จธ์ง๋ฅผ ๊ตฌํ ๋
| ์ ๋ ฅ ๋ฐฉ๋ฒ | ์๋ |
| 100**100%100 | 1.1507907 |
| pow(100, 100, 100) | 0.6850590000000001 |
- ๋๋จธ์ง๊น์ง ํ์ ๋๋ pow๊ฐ ํจ์ฌ ๋น ๋ฅด๋ค!! pow๋ฅผ ์จ๋ณด์
๐ต ์์ธ...
1000์ 1์น์ 100์ผ๋ก ๋๋ ๋๋จธ์ง
| ์ ๋ ฅ ๋ฐฉ๋ฒ | ์๋ |
| 100**10%10 | 0.007485599999999995 |
| pow(100,10,10) | 0.682323 |
- ์์ ์๋ฅผ ๊ณ์ฐํ ๋๋ pow๊ฐ ๋๋ฆฌ๋ค.... ๐๐๐๐๐ ํฐ ์๋ฅผ ๊ณ์ฐํ ๋๋ง ์ฐ์ (pow๋ ์๋๊ฐ ํฌ๊ฒ ๋ณํจ์ด ์๋ค)
์ฐธ๊ณ : https://www.programiz.com/python-programming/methods/built-in/pow
Python pow()
Join our newsletter for the latest updates.
www.programiz.com
pow() Parameters
The pow() function takes three parameters:
- x - a number, the base
- y - a number, the exponent
- z (optional) - a number, used for modulus
Hence,
- pow(x, y) is equal to x**y
- pow(x, y, z) is equal to x**y % z
๋ฐ์ํ
'Programming language > Python' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| [python] filter (2) | 2020.08.31 |
|---|---|
| [python] accumulate(itertools), ๋์ ํฉ (0) | 2020.08.30 |
| [python] defaultdict (0) | 2020.08.29 |
| [python] input, sys.stdin.readline (0) | 2020.08.27 |
| [python] heapq(ํํ, ์ฐ์ ์์ํ) (2) | 2020.08.26 |