Skip to content

Instantly share code, notes, and snippets.

float dataMin = MAX_FLOAT;
float dataMax = MIN_FLOAT;
x <- 5 # => 5
x = 5 # => 5
x,y,z = gets.chomp.split(' ').map { |s| s.to_i }
arr = Array.new(x) { Array.new(y) { Array.new(z)} }
num_z = z + 1
_x = 0
x.times do
_z = 0
num_z.times do
line_cell = gets.chomp
if (line_cell == "--")
next
N = gets.to_i
scores = []
N.times do
scores << gets.chomp.to_i
end
scores = scores.sort {|a,b| b <=> a}
flag0 = scores.inject(:+) < 1
Q = gets.to_i
Q.times do
limit = gets.chomp.to_i
def who_am_i(&block)
block.class
end
puts who_am_i {}
class Array
def iterate!(code)
# selfオブジェクトの要素数だけ繰り返す
self.each_with_index do |n,i|
# encoding: utf-8
require 'csv'
data = []
# データ作成
File.open("words.txt", "r:utf-8") do |f|
f.each_line do |line|
word = line.split(' ')[0]
count = line.split(' ')[1].to_i
using UnityEngine;
using System.Collections;
public class PointingController : MonoBehaviour
{
public GameObject wall;
public float distance;
public void Update()
{
// マウスの位置を取得
@valbeat
valbeat / file0.cs
Last active September 14, 2015 09:14
クリックしたオブジェクトの名前を取得 ref: http://qiita.com/kajitack/items/799a18da3174a6af0b89
public class Touch : MonoBehaviour {
// rayが届く範囲
public float distance = 100f;
void Update () {
// 左クリックを取得
if (Input.GetMouseButtonDown(0)) {
// クリックしたスクリーン座標をrayに変換
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
// Rayの当たったオブジェクトの情報を格納する
Shader "Custom/mouse_position" {
Properties {
_MainTex ("Texture", 2D) = "white" {}
}
SubShader {
Tags { "RenderType" = "Opaque" }
CGPROGRAM
#pragma surface surf Lambert vertex:vert
struct Input {
float2 uv_MainTex;
Shader "Custom/shock_wave" {
Properties {
}
SubShader {
Pass {
// GLSLシェーダ
GLSLPROGRAM
#ifdef VERTEX
void main()