Skip to content

Instantly share code, notes, and snippets.

View cohalz's full-sized avatar
🌴
On vacation

cohalz cohalz

🌴
On vacation
View GitHub Profile
object Main {
def main(args: Array[String]) = {
val n = readLine().toInt
val c = readLine()
val num = Array(0,0,0,0)
c collect {
case s:Char => num(s.asDigit-1) += 1
}
println(num.max +" "+ num.min)
}
object Main {
def main(args: Array[String]) = {
val x = readLine()
val s = readLine()
println(s.filterNot(_.toString==x))
}
}
@cohalz
cohalz / .gvimrc
Created September 16, 2013 12:17
let $SSH_ASKPASS = simplify($VIM . '/../../MacOS') . '/macvim-askpass'
set noimdisable
set imdisableactivate
if has('gui_macvim')
set guioptions-=T
set showtabline=2 " タブを常に表示
set transparency=9 " 透明度
set imdisable " IME OFF
@cohalz
cohalz / .vimrc
Created September 16, 2013 12:18
set nocompatible
filetype off
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim
call neobundle#rc(expand('~/.vim/bundle/'))
endif
NeoBundle 'Shougo/neobundle.vim'
NeoBundle 'Shougo/neocomplcache'
#include <stdio.h>
#define maxRow 10 //最大行数
int main(void) {
int i,j,n,sumNum; //nは正方行列の大きさ、sumNumは魔方陣であった場合の各要素の和。
int arr[maxRow][maxRow]; //行列。
int row[maxRow] = {0}; //各行の要素の和が入る。
int column[maxRow] = {0}; //各列の要素の和が入る。
int cross[2] = {0}; //斜め(cross[0]は右下がり,cross[1]は右上がり)の要素の和が入る。
int numFlag[maxRow*maxRow] = {0}; //各数字が出た回数、例えば1が2回出たならnumFlag[0]が2になる。
printf("n = ");
#include <stdio.h>
#include <stdlib.h>
#define maxRow 99 //最大行数
int main() {
int n,x,y;
int count = 1; //探索している数字。
short **arr,*base_arr; //行列。
printf("n = ");
while(scanf("%d", &n) != 1 || n < 3 || n > maxRow || n%2 == 0) {
printf("#matrix must be at least 3 and at most %d and odd.\n",maxRow);
#include <stdio.h>
#define maxRow 15 //最大行数
int main(){
int n; //正方行列の大きさ。
int y = 0;
int x = 0;
int top = 0; //上から数えて何行埋まっているか。文字を右に進みながら入れていき、右端にたどり着けばその行はもう埋まった扱いにする。
int bottom = 0; //同上。
int left = 0; //同上。
int right = 0; //同上。
#include <stdio.h>
#define maxRow 15 //最大行数
int main(){
int n,y,x; //正方行列の大きさ。
int count = 0; //文字を入れ終わった回数。
char arr[maxRow][maxRow]; //行列。
char printChar = 'Z'; //初期位置の文字。ここをYやCにしても動くように対応。
enum directions { UP,LEFT,DOWN,RIGHT };
enum directions direction = UP;
printf("n = ");
#include <stdio.h>
int main(){
int i,n;
float c;
printf("c = ");
if(scanf("%f", &c) != 1 || c < 2) {
puts("Wrong input.");
return 1;
}
printf("n = ");
#include <stdio.h>
int recursion(int n){
if(n == 1) return 1;
if(n == 2) return 2;
return 3*recursion(n-1)+2*recursion(n-2);
}
int main(){
int n,i;
printf("n = ");
while(scanf("%d", &n) != 1 || n < 3) {