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 RPNCalculator { | |
import std.algorithm : all, canFind, map; | |
import std.ascii : isDigit, isWhite; | |
import std.conv : to; | |
import std.string : split; | |
import std.range; | |
alias Stack = int[]; | |
bool isNum(const char[] cs) { | |
return cs.all!(c => isDigit(c)); |
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
// cとみせかけてc++の文法を使う可能性もある | |
#define _CRT_SECURE_NO_WARNINGS | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <assert.h> | |
#define N 6 |
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
// 二部マッチング | |
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_7_A | |
// https://beta.atcoder.jp/contests/abc091/tasks/arc092_a | |
import std.stdio, std.algorithm, std.string, std.conv, std.array, std.range, std.math; | |
void main() { | |
auto bm = new BipartiteMatching(); | |
int X, Y, E; | |
readf("%d %d %d\n", &X, &Y, &E); |
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
// | |
// $ dmd margesort.d -main -unittest | |
// | |
import std.stdio; | |
T[] margesort(T)(T[] a) { | |
int n = a.length; | |
if (n <= 1) return a; | |
T[] left = a[0..n/2].margesort; |
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
# | |
# ツイートは 2014/04/01 まで取得済み | |
# | |
import tweepy | |
import random | |
import time | |
def get_api(): |
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
struct LCA { | |
typedef vector<vector<int>> Graph; | |
Graph G; | |
vector<int> depth; | |
vector<vector<int>> parent; | |
int n, root, MAXLOG; | |
LCA(int _n) { | |
root = 0; | |
n = _n; |
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 <cstdlib> | |
#include <cmath> | |
#include "GL/glut.h" | |
using namespace std; |
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 "GL/glut.h" | |
using namespace std; | |
// 直方体の表面 | |
int face[][4] = { | |
{0, 3, 2, 1}, | |
{1, 2, 6, 5}, |
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
// | |
// トランプのダイヤの3を作成する。 | |
// ポリゴン1,2,3を作り、ポリゴン1,3をそれぞれy軸側に-0.5, +0.5 移動させる。 | |
// 全体を45度回転させる。 | |
// | |
#include <cstdlib> | |
#include <cstdio> | |
#include "GL/glut.h" |
NewerOlder