Skip to content

Instantly share code, notes, and snippets.

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<class T> T lcm(T a, T b) { return a / gcd(a,b) * b; }
template<class T>
class Fraction{
void normalize(){
if(p == 0){
q = 1;
} else {
T g = gcd(p,q);
private string GetPythonPath()
{
Func<Microsoft.Win32.RegistryKey, string> get_path = key =>
{
using (var sub_key = key.OpenSubKey(@"SOFTWARE\Python\PythonCore\2.7\InstallPath"))
{
if (sub_key == null)
return null;
var path = (string)sub_key.GetValue(null);
private string GetPythonPath()
{
Func<Microsoft.Win32.RegistryKey, string> get_path = key =>
{
using (var sub_key = key.OpenSubKey(@"SOFTWARE\Python\PythonCore\2.7\InstallPath"))
{
if (sub_key == null)
return null;
var path = (string)sub_key.GetValue(null);
public class TupleFunc
{
public static Func<Tuple<T1, T2>, TResult> Create<T1, T2, TResult>(Func<T1, T2, TResult> f)
{
return new Func<Tuple<T1, T2>, TResult>(t => f(t.Item1, t.Item2));
}
}
public static Main{
static void Main()
public class TupleFunc
{
public static Func<Tuple<T1, T2>, TResult> Create<T1, T2, TResult>(Func<T1, T2, TResult> f)
{
return new Func<Tuple<T1, T2>, TResult>(t => f(t.Item1, t.Item2));
}
}
public static Main{
static void Main()
元URL : https://gist.github.com/masashinakata/5668219
### 補足 ###
# インストールする先は CentOS 5.9(final) x86_64(intelの64bitのこと)
# PATHは$HOME/usr/local/binと$HOME/usr/local/gcc-4.8.0/binへ、
# LD_LIBRARY_PATHは$HOME/usr/local/libを追加すると捗る
# お好みでmake checkする ただしPPLのmake checkは恐ろしく時間がかかる?
# Assuming that everything will reside on $HOME/usr/local directory as
# depicted below:
import pylab
x = range(10)
y = range(10)
pylab.plot(x,y,'-')
pylab.title(u"日本語")
pylab.show()
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
using namespace std;
void solve(istream& in)
{
vector<vector<int> > v;