Skip to content

Instantly share code, notes, and snippets.

@Tsutomu-KKE
Created July 4, 2014 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tsutomu-KKE/ef8d87d39c820744431f to your computer and use it in GitHub Desktop.
Save Tsutomu-KKE/ef8d87d39c820744431f to your computer and use it in GitHub Desktop.
最大公約数
{
"metadata": {
"name": "",
"signature": "sha256:adf3c1871bc37a57209755d4cb046cfbca2697df3b6a1388aa872e1838037bee"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#\u30e6\u30fc\u30af\u30ea\u30c3\u30c9\u306e\u4e92\u9664\u6cd5(\u6700\u5927\u516c\u7d04\u6570)"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"def gcd(a, b):\n",
" while b: a, b = b, a % b\n",
" return a"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"%time gcd(12, 18)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Wall time: 0 ns\n"
]
},
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 4,
"text": [
"6"
]
}
],
"prompt_number": 4
}
],
"metadata": {}
}
]
}
@Tsutomu-KKE
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment