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/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 |
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/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 |
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/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 |
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/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 |
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/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 |
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/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 |
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
#include <cstdio> | |
#include <winsock2.h> | |
#include<windows.h> | |
#include<string.h> | |
#include<tchar.h> | |
int State;//状態 | |
int X;//何分の平均を取るか | |
void kansoku(HANDLE hsemaphore[]) { |
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/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 />"} |
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
// 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); |
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
#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); |