Skip to content

Instantly share code, notes, and snippets.

@unvBell
unvBell / Test_Unit.cpp
Last active August 29, 2015 14:26
UnitType
#include <iostream>
#include <gtest/gtest.h>
#include "Unit.hpp"
using namespace bell::unit;
namespace {
template <typename T> using Number = Unit<T, 0, 0, 0>;
template <typename T> using Length = Unit<T, 1, 0, 0>;
template <typename T> using Mass = Unit<T, 0, 1, 0>;
#include <iostream>
#include <cstdint>
constexpr uint32_t crc32Table[256] = {
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
#include <cstdio>
#include <initializer_list>
template <int... N>
struct Array {
static void put() {
for(int x : { N... })
printf("%d\n", x);
}
};
#include <cstdio>
template <char... C>
struct S {
static const char* value() {
static constexpr char s[] = { C..., '\0' };
return s;
}
};
#include <string>
#include "Recorder.hpp"
namespace {
/**
* 処理に失敗していたら例外を投げる
* @param message エラーメッセージ
* @param result 処理の結果
* @throws runtime_error 処理が失敗していた時
*/
#include <iostream>
#include <stack>
#include <string>
#include <sstream>
#include <map>
#include <cassert>
#include <cstdlib>
using namespace std;
@unvBell
unvBell / Q3_3.c
Last active August 29, 2015 14:22
// 入力された文字列のうち、数値だけを出力せよ
// in:S
#include <stdio.h>
int main(void) {
int c;
puts("?");
while((c = getchar()) != EOF) {
if(isdigit(c)) {
@unvBell
unvBell / Q1_1.c
Last active August 29, 2015 14:20
// 数値の四則演算結果を出力せよ
// in:A B
#include <stdio.h>
int main(void) {
double a, b;
puts ("?");
scanf("%lf%lf", &a, &b);