Skip to content

Instantly share code, notes, and snippets.

View Leko's full-sized avatar
🏠
Working from home

Shingo Inoue Leko

🏠
Working from home
View GitHub Profile
@Leko
Leko / AOJ_0107.cpp
Created June 8, 2013 15:38
AOJ 0107 Carry a Cheese Time Limit : 1 sec, Memory Limit : 65536 KB
#include <cmath>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define REP(i, n) for ( int i = 0; i < n; i++ )
using namespace std;
@Leko
Leko / AOJ_0104.cpp
Last active December 18, 2015 05:49
AOJ_0104 Magical Tiles Time Limit : 1 sec, Memory Limit : 65536 KB
// clear time: 00:30
#include <iostream>
#include <string>
#include <vector>
#define REP(i, n) for ( int i = 0; i < n; i++ )
using namespace std;
void dump(vector<string> f, int x = -1, int y = -1) {
@Leko
Leko / asciify.out
Created June 9, 2013 06:24
asciify all fonts.
001: 3-d
** ** ** ** ** **
/** /** /** /** /** /**
/** /** ***** /** /** ****** *** ** ****** ****** /** /**
/********** **///** /** /** **////** //** * /** **////**//**//* /** ******
/**//////**/******* /** /**/** /** /** ***/**/** /** /** / /** **///**
/** /**/**//// /** /**/** /** /****/****/** /** /** /**/** /**
/** /**//****** *** ***//****** ***/ ///**//****** /*** ***//******
// // ////// /// /// ////// /// /// ////// /// /// //////
@Leko
Leko / CodeIQ_q335.rb
Last active December 18, 2015 07:08
CodeIQの「コードゴルフ:ぐるぐる渦巻き」 https://codeiq.jp/ace/ozy4dm/q335 を更新しました。206文字です。もう期限終了してるけれど。 提出出来た前のバージョンはリビジョンを参照。
M=-1,v=y=0,1,0;a,N=Array,gets.to_i;D=N*N;x,f=N-1,a.new(N) {a.new};D.times{|i|f[y][x]="%*d"%[D.to_s.size,D-i,c=x+M[v],d=y+M[3-v]];v=c*d<0||c==N||d==N||f[d][c]?(v+1)%4:v;x+=M[v];y+=M[3-v]};f.map{|y|puts y*' '}
@Leko
Leko / AOJ_1150.cpp
Last active December 18, 2015 13:48
AOJ_1150 Cliff Climbing http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1150 複数のキューを使っているので、プライオリティキューを利用できなかった。
// start: 21:57
// AC: 00:12
#include <cstdio>
#include <climits>
#include <iostream>
#include <vector>
#include <queue>
#define REP(i, n) for ( int i = 0; i < n; i++ )
@Leko
Leko / AOJ_1150_pq.cpp
Last active December 18, 2015 14:09
AOJ_0050 Cliff Climbingをclass+priority_queueで解いてみた。 これなら最初にゴールに至った経路=最小コストなので楽ちん。
// start: 21:57
// AC: 00:12
#include <cstdio>
#include <climits>
#include <iostream>
#include <vector>
#include <queue>
#define REP(i, n) for ( int i = 0; i < n; i++ )
#define INF INT_MAX
@Leko
Leko / _fizzbuzz.scss
Created June 25, 2013 02:13
mixins of FizzBuzz by Sass
@mixin fizzbuzz_content($n) {
$fb: '', '', Fizz, '', Buzz, Fizz, '', '', Fizz, Buzz, '', Fizz, '', '', FizzBuzz;
$cont: '';
@for $i from 1 through $n {
@if nth($fb, ($i - 1) % 15 + 1) == '' {
$cont: $cont + $i + ' '
} @else {
$cont: $cont + nth($fb, ($i - 1) % 15 + 1) + ' ';
}
@Leko
Leko / fizzbuzz_bth.scss
Last active December 18, 2015 22:39
CSSでのFizzBuzzをSassのmixin化してみました。
@mixin fizzbuzz_nth($fs: 18px) {
li {
font-size: $fs;
display: inline-block;
}
li:nth-child(3n), li:nth-child(5n) {
font-size: 0;
}
li:nth-child(3n):before {
font-size: $fs;
@Leko
Leko / fizzbuzz_content.scss
Last active December 18, 2015 22:39
SassでFizzBuzzするmixin
@mixin fizzbuzz_content($n: 100) {
$fb: '', '', Fizz, '', Buzz, Fizz, '', '', Fizz, Buzz, '', Fizz, '', '', FizzBuzz;
$cont: '';
@for $i from 1 through $n {
@if nth($fb, ($i - 1) % 15 + 1) == '' {
$cont: $cont + $i + ' '
} @else {
$cont: $cont + nth($fb, ($i - 1) % 15 + 1) + ' ';
}
}
@Leko
Leko / fizzbuzz_not_remainder.scss
Created June 25, 2013 05:34
剰余算を使わないSassでのFizzBuzz
@mixin fizzbuzz_not_remainder($n: 100) {
$fb: '', '', Fizz, '', Buzz, Fizz, '', '', Fizz, Buzz, '', Fizz, '', '', FizzBuzz;
$cont: '';
@for $i from 1 through $n {
$tmp: $i;
@while $tmp > 15 {
$tmp: $tmp - 15;
}
@if nth($fb, $tmp) == '' {
$cont: $cont + $i + ' ';