Skip to content

Instantly share code, notes, and snippets.

#coding:utf-8
from __future__ import division #整数割り算時の切り捨て解除
#演算子と文字列(出力用)のリスト
funcs=[lambda x,y:x+y,lambda x,y:x-y,lambda x,y:y-x,lambda x,y:x*y,lambda x,y:x/y,lambda x,y:y/x]
sikifuncs=[lambda x,y:"("+x+"+"+y+")",lambda x,y:"("+x+"-"+y+")",lambda x,y:"("+y+"-"+x+")",lambda x,y:"("+x+"*"+y+")",lambda x,y:"("+x+"/"+y+")",lambda x,y:"("+y+"/"+x+")"]
def make(numlist,ans,siki):
L=len(numlist)
if L==1:
import decimal
decimal.getcontext().prec = 100
dd=decima.Decimal
def pi(x):
xx=dd(1)
xt=0
for a in range(x):
xt+=dd(4)/xx
xt*=dd(-1)
xx+=dd(2)
from __future__ import division
import decimal
decimal.getcontext().prec = 100
dd=decimal.Decimal
def newton(x):
xn=dd(0)
while True:
xn+=1
#include<stdio.h>
int main(){
int a,b;
for(a=1;a<=9;a++){
for(b=1;b<=9;b++){
printf("%dx%d=%d\n",a,b,a*b);
}
}
return 0;
}
main(a,b){for(a=1;a<=9;a++)for(b=1;b<=9;b++)printf("%dx%d=%d\n",a,b,a*b);return 0;}
main(a,b){for(;a<=9;a++)for(b=1;b<=9;b++)printf("%dx%d=%d\n",a,b,a*b);}
main(a,b){b=0;for(;a<=9;(b%=9)||a++)printf("%dx%d=%d\n",a,++b,a*b+a);}
@catupper
catupper / GCJJ2011_A.c
Created October 1, 2011 12:54
GCJJ2011
#include<stdio.h>
int main(){
int T,M,C,W,i,j;
scanf("%d",&T);
for(i=1;i<=T;i++){
scanf("%d%d%d",&M,&C,&W);
int A[100],B[100];
for(int j=0;j<C;j++){
scanf("%d%d",&A[j],&B[j]);
A[100],B[100],M,C,W,j;int main(i){for(gets(&M);~scanf("%d%d%d",&M,&C,&W);printf("Case #%d: %d\n",i++,W+1)){for(j=0;j<C;j++)scanf("%d%d",&A[j],&B[j]);for(W--,j=C-1;j+1;j--)W=W<A[j]+B[j]-1?W<B[j]?W=A[j]+W-1:W-B[j]:W;}}
@catupper
catupper / pi.py
Created December 9, 2011 03:53
pi
from decimal import getcontext , Decimal
from math import sqrt
def root(a):
x=Decimal(sqrt(a))
y=Decimal(0)
while(abs(x-y)>Decimal(0.1)**(getcontext().prec-1)):
x,y=x-(x*x-a)/(2*x),x
return x