This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# -*-coding:utf-8-*- | |
def main(): | |
i = input() | |
while True: | |
i = i*i | |
if i >= 10^100: | |
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
def main(): | |
while True: | |
year = input("年を入力:") | |
if year % 4 == 0 and not year % 100 == 0 or year % 400 == 0: | |
print year,"年は閏年です。" | |
else if year == none: | |
break | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
def nroot(a, n, x=1.0, eps=1e-7): | |
while abs(a - x**n) > eps: | |
x = ( (n-1)*x + a/(x**(n-1)) ) / n | |
return x | |
def main(): | |
print "aX^2+bX+c=0" | |
while True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class chap1 { | |
public static void main(String[] args) { | |
System.out.print("abc"); | |
System.out.print("def"+"ghi"); | |
System.out.println("jkl\nxyz"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
def gcd(a, b): | |
if b == 0: | |
return a | |
else: | |
return gcd(b, a%b) | |
a = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# coding: utf-8 | |
# φ (n) を調べる -> wikiでこんな公式みつける φ (n) = n * Π (1 - 1/Pk) | |
# 変形して φ (n) / n = Π (1 - 1/Pk) の最小 -> 1 - 1/Pk < 1なのでkが大きいほど | |
# 小さいことがわかる | |
# P1P2...Pk<=1000000を探しませう | |
# Pythonの機能使うと素数列挙簡単らしいけど… |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UnityEngine | |
class BallController(MonoBehaviour): | |
public Speed as single = 20.0f | |
def Start(): | |
rigidbody.AddForce((transform.forward+transform.right) * Speed, ForceMode.VelocityChange) | |
def Update(): | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UnityEngine | |
class Player (MonoBehaviour): | |
public speed as single = 8.0f | |
public gravity as single = 10.0f | |
public controller as CharacterController | |
public jumpSpeed as single = 6.0f | |
public moveDirection as Vector3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! python | |
l1 = ['one','two','three','four','five','six','seven','eight','nine'] | |
l2 = ['ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen'] | |
l3 = ['twenty','thirty','forty','fifty','sixty','seventy','eighty','ninety'] | |
l4 = ['hundred', 'thousand', 'and'] | |
ans = 0 | |
for i in l1: | |
ans = ans + len(i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! python | |
ndays = [31,28,31,30,31,30,31,31,30,31,30,31] | |
ldays = [31,29,31,30,31,30,31,31,30,31,30,31] | |
day = 0 # 0--Monday --> 6--Sunday | |
ans = 0 | |
def isleap(year): | |
if year % 4 == 0 and (year % 100 != 0 or year % 400 == 0): | |
return True |
OlderNewer