Skip to content

Instantly share code, notes, and snippets.

@macrat
macrat / linq.cs
Created June 15, 2016 14:22
6月15日のC#勉強会の課題実装例
using System;
using System.Linq;
using CampusSquare;
class Example2 {
public static void Main() {
var grades = new CampusSquare.DummyCampusSquare("record.html").GetGrades();
Console.WriteLine("GPA: " + (
@macrat
macrat / example.cs
Last active June 15, 2016 05:24
06/15日のC#勉強会で出した課題の解答例(LINQ版)
using System;
using System.Linq;
using CampusSquare;
class Example2 {
public static void Main() {
var grades = new CampusSquare.DummyCampusSquare("record.html").GetGrades();
Console.WriteLine("GPA: " + (
#include <algorithm>
#include <iostream>
#include <vector>
class Team {
private:
int resolve, time;
std::vector<int> failures;
#include <algorithm>
#include <iostream>
#include <iterator>
#include <unordered_set>
#include <vector>
int read_i() {
int t;
std::cin >> t;
#include <algorithm>
#include <iostream>
#include <iterator>
#include <set>
#include <vector>
class Position {
private:
int x, y;
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
struct {
int_fast32_t x, y;
} typedef Position;
#include <cmath>
#include <iostream>
int withoutTax(int cost, int tax){
return std::ceil(cost * 100.0 / (100.0+tax));
}
int withTax(int cost, int tax){
#include <iostream>
#include <set>
class Position {
const int x, y;
public:
Position(int x, int y) : x(x), y(y) { }
@macrat
macrat / fizzbuzz.cpp
Last active May 23, 2016 12:40
FQDNで安全なFizzBuzzライフ。
#include <iostream>
#include <iterator>
#include <memory>
namespace funnycounter {
namespace item {
namespace interface {
@macrat
macrat / fizzbuzz.c
Last active April 22, 2016 10:03
不適切なFizzBuzz
#define func(name, expression, ...) int name(__VA_ARGS__){ return expression; }
int PutC(char c){ char*t=&c; asm("mov $1,%%rax\nmov $1,%%rdi\nmov %0,%%rsi\nmov $1,%%rdx\nsyscall" :: "m"(t)); return 0; }
func(PutS, *string && PutC(*string) & PutS(string + 1), char* string);
func(EndL, PutC(0x0a));
func(Fizz, PutS((char*)__func__));