Skip to content

Instantly share code, notes, and snippets.

@akahana-1
akahana-1 / calc.pas
Created December 15, 2012 14:18
授業で作成した多倍長整数(30桁)を計算する電卓
program calc(input,output);
const DIGIT = 30;
type ary = array[0..DIGIT-1] of integer;
var a,b,c:ary; op:char;
procedure InputNum(var a:ary);
var ch:char;
i:integer;
begin
for i := 0 to DIGIT-1 do
begin;
#! /usr/env/bin python
# -*- coding;utf-8 -*-
import sys
class Parser():
def __init__(self):
self.s = ""
self.ptr = 0
self.mem = [ 0 for x in range(0, 100) ]
import math
def reinv_ldexp(x, n):
b = 2 if n >= 0 else 1 / 2
n *= -1 if n < 0 else 1
a = int(n)
while a > 0:
if bool(a & 1):
x *= b
b *= b
#! /usr/bin/env python3
# -*- coding:utf-8 -*-
import subprocess
#import csv
import random
import time
import matplotlib.pyplot as plot
efiles = ["./a.out {0} {1}", "python3 prime.py {0} {1}"]
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
int x, y, s, m;
while(cin >> x >> y >> s, x){
m = 0;
for(int i = 1;i < s;++i){
@akahana-1
akahana-1 / 0211.cpp
Created October 27, 2014 08:58
周回距離と速度の最小公倍数から周回距離を割ったものが全て同一であればいいはず……(しかしWA
#include <iostream>
#include <utility>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
bool alldiv(ll t, ll* nums, ll n){
@akahana-1
akahana-1 / B.cpp
Created December 22, 2014 22:21
CODE THANKS FESTIVAL B日程
#include <iostream>
#include <algorithm>
using namespace std;
int calc(int a, int b, int opr){
switch (opr){
case 1:
return a + b;
case 2:
return a - b;
@akahana-1
akahana-1 / 0223.cpp
Created April 24, 2015 15:16
解けないなあ……
#include <iostream>
#include <algorithm>
#include <queue>
#include <utility>
#include <map>
using namespace std;
const int Y = 50, X = 50, GUARD = 1;
typedef pair<int, int> P;
# -*- coding:utf-8 -*-
import re
re.match(r"[0−9]", "9000")
# <_sre.SRE_Match object; span=(0, 1), match='9'>
re.match(r"[0−9]+", "9000")
# <_sre.SRE_Match object; span=(0, 4), match='9000'>
re.match(r"[0−9]+", "90001909039")
@akahana-1
akahana-1 / get_clearlamp.py
Last active February 18, 2016 18:03
クリアランプマネージャーから一括でクリアランプを持ってくる
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
#requirement : lxml
import lxml.html
import urllib.request as req
LAMP_URL = "http://www.beatmania-clearlamp.com/djdata/%s/sp/"