Skip to content

Instantly share code, notes, and snippets.

View marionette-of-u's full-sized avatar

arithmeticae marionette-of-u

View GitHub Profile
@marionette-of-u
marionette-of-u / integer.hpp
Last active August 29, 2015 14:22
多倍精度整数. Newton法 + Barrett法除算を追加. その他デバッグ. 異常があったら連絡ください.
#ifndef MULTI_PRECISION_INCLUDE_INTEGER_HPP
#define MULTI_PRECISION_INCLUDE_INTEGER_HPP
#include <algorithm>
#include <vector>
#include <iostream>
#include <string>
#include <iterator>
#include <utility>
#include <random>
#include <iostream>
int main(){
// 適当な数
#define Sup 9
#define GetBit(a, i) (((a) >> (i)) & 1)
#define Increment(a, carry) { \
++(a); \
unsigned char sub = ((a) - Sup); \
#include <set>
#include <iostream>
int main(){
std::set<int> single, first1, first2, second1, second2;
for(int i = 0x21; i <= 0x5B; ++i){
single.insert(i);
}
for(int i = 0x5D; i <= 0x7D; ++i){
@marionette-of-u
marionette-of-u / u.txt
Last active August 29, 2015 14:13
The U Programming Language
t_category my_term_category
v_category my_var_category
(* function i(x, y) *)
let i = my_term_category "i" [_, _]
(* constant j *)
let j = my_term_category "j" []
(* constant k *)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TRS
{
class VF
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TRS
{
using RuleSet = SortedSet<TermPair>;
using Subst = List<SubstItem>;
// Extended Euclidean Algorithm.
struct eea_result{
DoubleInt result, s, t;
};
static eea_result eea(DoubleInt a, DoubleInt b){
eea_result p;
if(b == 0){
p.result = a;
p.s = 1;
#ifndef MULTI_PRECISION_INCLUDE_INTEGER_HPP
#define MULTI_PRECISION_INCLUDE_INTEGER_HPP
#include <algorithm>
#include <vector>
#include <iostream>
#include <string>
#include <iterator>
#include <utility>
#include <random>
@marionette-of-u
marionette-of-u / my_sha1.cpp
Last active August 29, 2015 14:06
my_sha1.cpp
#include <iostream>
#include <fstream>
#include <cstdio>
unsigned char Base64EncodeMap[128];
int search(unsigned char const* __restrict target, int target_length){
unsigned long A, B, C, D, E;
unsigned long H[5];
unsigned long W[80];
#include <cstdlib>
#include <string>
#include <vector>
struct ast{
std::vector<ast*> sub;
std::string token;
std::string type;
};