Skip to content

Instantly share code, notes, and snippets.

View yamaguchi1024's full-sized avatar
🐈

Yuka Ikarashi yamaguchi1024

🐈
View GitHub Profile
#!/usr/bin/ruby
require 'openssl'
class Array
def merge_sort
tmp = self.dup
return tmp if tmp.length <= 1
a, b = self.half.map { |e| e.merge_sort }
merge(a, b)
end
def half
#!/usr/bin/ruby
require 'openssl'
class Array
def quick_sort
return self if length <= 1
base = pop
smaller, bigger = partition { |e| e < base }
push base
smaller.quick_sort + [base] + bigger.quick_sort
end
#!/usr/bin/ruby
require 'openssl'
class Array
def quick_sort
# if ($n==500 && $log<700) || ($n==2000 && $log<3000) || ($n==4000 && $log<6000) || ($n==6000 && $log<8500) || ($n==8000 && $log<11000) || ($n==10000 && $log<14000)
# $log+=1
return self if length <= 1
base = pop
smaller, bigger = partition { |e| e < base }
push base
#!/usr/bin/ruby
require 'openssl'
class Array
def quick_sort
# if ($n==500 && $log<700) || ($n==2000 && $log<3000) || ($n==4000 && $log<6000) || ($n==6000 && $log<8500) || ($n==8000 && $log<11000) || ($n==10000 && $log<14000)
# $log+=1
return self if length <= 1
base = pop
smaller, bigger = partition { |e| e < base }
push base
#!/usr/bin/ruby
require 'openssl'
class Array
def quick_sort
if ($n==500 && $log<700) || ($n==2000 && $log<3000) || ($n==4000 && $log<6000) || ($n==6000 && $log<8500) || ($n==8000 && $log<11000) || ($n==10000 && $log<14000)
$log+=1
return self if length <= 1
base = pop
smaller, bigger = partition { |e| e < base }
push base
#!/usr/bin/ruby
require 'openssl'
class Array
def quick_sort
if ($n==500 && $log<700) || ($n==2000 && $log<3000) || ($n==4000 && $log<6000) || ($n==6000 && $log<8500) || ($n==8000 && $log<11000) || ($n==10000 && $log<14000)
$log+=1
return self if length <= 1
base = pop
smaller, bigger = partition { |e| e < base }
push base
#include <cstdio>
#include <winsock2.h>
#include<windows.h>
#include<string.h>
#include<tchar.h>
int State;//状態
int X;//何分の平均を取るか
void kansoku(HANDLE hsemaphore[]) {
#!/usr/local/bin/ruby
#/bin/env ruby
require 'csv'
require 'cgi'
def error_cgi
print "Content-Type:text/html;charset=EUC\n\n"
print "*** CGI Error List ***<br />"
print "#{CGI.escapeHTML($!.inspect)}<br />"
$@.each {|x| print CGI.escapeHTML(x), "<br />"}
// g++ -O2 -o encrypt.exe encrypt.cpp mt19937ar.cpp
#include <stdio.h>
#include <stdlib.h>
#include "mt19937ar.h"
typedef unsigned long dword;
void initialize(const char *seed);
void encrypt(const char *plain, const char *crypt, const char *key);
#include<stdio.h>
#include<stdlib.h>
typedef unsigned long dword;
dword temper(dword y){
y ^= (y >> 11);
y ^= (y << 7) & 0x9d2c5680UL;
y ^= (y << 15) & 0xefc60000UL;
y ^= (y >> 18);