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
// oriに長さ50のスコアがいい文字列を渡す | |
// lower_score以下の部分文字列はその文字列は枝返り、ok_scoreが見つかったら他の部分文字列は枝返り | |
void get_substr(const string& ori, int lower_score, int ok_score, int len = 8) | |
{ | |
bool ignore[55][55]; | |
clr(ignore, 0); | |
set<string> visit; | |
queue<string> q; | |
q.push(ori); |
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 <cstdlib> | |
#include <cstring> | |
#include <cmath> | |
#include <climits> | |
#include <cfloat> | |
#include <ctime> | |
#include <cassert> | |
#include <map> | |
#include <utility> |
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 <cstdlib> | |
#include <cstring> | |
#include <cmath> | |
#include <climits> | |
#include <cfloat> | |
#include <ctime> | |
#include <cassert> | |
#include <map> | |
#include <utility> |
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/env python3 | |
import re | |
import html | |
from bs4 import BeautifulSoup | |
import requests | |
class TestCase: |
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
class PrimeFactor | |
{ | |
public: | |
int n; | |
vector<int> factor; | |
PrimeFactor(int n) | |
: n(n), factor(n + 1, -1) | |
{ | |
for (int i = 2; i <= n; ++i) | |
{ |
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
//// Date | |
// __days[month - 1] | |
static const int __days[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; | |
// __sum_days[month] -> sum_days(1, 2, .., month - 1) | |
static const int __sum_days[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }; | |
const int days_of_year = 365; | |
class Date |
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
template <typename T> | |
class Dinic | |
{ | |
struct DinicEdge | |
{ | |
int to; | |
T cap; | |
int rev; | |
DinicEdge(int to, T cap, int rev) | |
: to(to), cap(cap), rev(rev) {} |
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/env ruby | |
require 'fileutils' | |
require 'open-uri' | |
require 'nokogiri' | |
require 'open3' | |
class Test | |
attr_accessor :number, :input, :output |
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
class Integer | |
def prime? | |
n = self.abs() | |
return true if n == 2 | |
return false if n == 1 || n & 1 == 0 | |
d = n-1 | |
d >>= 1 while d & 1 == 0 | |
10000.times do # 20 は上の説明の k に相当 | |
a = rand(n-2) + 1 | |
t = d |
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
1.upto(0.0/0){|n| puts n or break if (1..6).map{|i| (n * i).to_s.split(//).sort}.uniq.length == 1} |