Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
typedef struct{
float x;
float y;
}point;
typedef struct{
point ul;
point lr;
}rect;
puts "Hello World!"
10.times do |i|
puts i+1
end
names = ["ruby", "is", "awesome"]
for name in names
puts name
end
一隻神奇聰明貓走進了一間亂七八糟的房間,他不想自己動手收拾,他決定要找幫手來工作。於是他從他的帽子中變出了N隻小貓來幫他(變出來的貓,高度為原來貓的 1/(N+1) )。這些小貓也有帽子,所以每一隻小貓又從他的帽子中變出N隻小小貓來幫他。如此一直下去,直到這些小小小....貓小到不能再小(高度=1),他們的帽子無法再變出更小的貓來幫忙,而這些最小的貓只得動手打掃房間。注意:所有貓的高度都是正整數。
在這個問題中,給你一開始那隻貓的高度,以及最後動手工作的貓的數目(也就是高度為1的貓的數目)。要請你求出有多少隻貓是沒有在工作的,以及所有貓的高度的總和。
Input
每組測試資料一列,有2個正整數分別代表一開始那隻貓的高度,以及最後動手工作的貓的數目。0 0代表輸入結束。
Output
每組測試資料輸出一列,包含2個正整數分別代表有多少隻貓是沒有在工作的,以及所有貓的高度的總和。
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.MatOfRect;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.highgui.Highgui;
import org.opencv.highgui.VideoCapture;
import org.opencv.objdetect.CascadeClassifier;
@Yi-Tseng
Yi-Tseng / main.c
Last active December 15, 2015 16:39
20130402 社課
#include <allegro5/allegro.h>
#include <allegro5/allegro_primitives.h>
#include <allegro5/allegro_ttf.h>
#include <allegro5/allegro_font.h>
#include <stdio.h>
struct bar{
int y;
}bar1, bar2;
@Yi-Tseng
Yi-Tseng / gist:5290868
Created April 2, 2013 08:47
20130402社課-2
if((a.x+a.w >= b.x) || (b.x+b.w >= a.x)){
if((a.y+a.h >= b.y) || (b.y+b.h >= a.y)){
// do some thing
}
}
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.NamingException;
import org.apache.activemq.ActiveMQConnectionFactory;
@Yi-Tseng
Yi-Tseng / AlgroithmHW1.java
Last active December 16, 2015 16:10
演算法第一次作業 Java版
package algroithmhw1;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
/**
*
* @author Takeshi
*/
#include <allegro5/allegro.h>
#include <allegro5/allegro_primitives.h>
#include <allegro5/allegro_ttf.h>
#include <allegro5/allegro_font.h>
#include <allegro5/allegro_audio.h>
#include <allegro5/allegro_acodec.h>
#include <allegro5/allegro_image.h>
F( n ) = [ 0 (if n < min[w1, w2] )
min[F(n-w1) + c1, F(n-w2) + c2]
]