This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# exercise of backtracking algorithm. | |
# 2008.07.26 | |
# | |
require 'pp' | |
# (x, y) のマスに置けるか | |
def test(x, y, board) | |
x.times do |i| | |
# 左 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# knapsack problem solution by DP | |
# | |
# from: | |
# Cプログラマのためのアルゴリズムとデータ構造 | |
# ISBN:4797304952 | |
# pp. 349 | |
# | |
# author: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# knapsack problem solution by backtracking. | |
# | |
# from: | |
# Cプログラマのためのアルゴリズムとデータ構造 | |
# ISBN:4797304952 | |
# pp. 348 | |
# | |
# author: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Github T-shirts をいっしょに買って送料を節約しませんか? | |
2-200枚なら送料が一律 $11 だそうですよ。 | |
http://rubyrags.com/products/10 | |
東京近郊で渡せる方がよいです。 | |
我もと思うかたは fork me. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSMutableArray *keys = [NSMutableArray arrayWithArray:[params allKeys]]; | |
[keys sortUsingSelector:@selector(compare:)]; // compare: is a member of NSString. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* hello world in Objective-C + Foundation framework. | |
* | |
* build: | |
* % cc -Wall -g -framework Foundation hello.m | |
*/ | |
#import <Foundation/Foundation.h> | |
int main(int argc, char *argv[]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* hello world in Objective-C + Foundation framework. | |
* | |
* build: | |
* % cc -Wall -g -framework Foundation hello.m | |
*/ | |
#import <Foundation/Foundation.h> | |
int main(int argc, char *argv[]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* compare [NSObject alloc] with malloc(sizeof(NSObject)) | |
* | |
* build: | |
* cc -Wall -g -framework Foundation alloc_cost.m | |
* | |
* result: | |
* % ./a.out | |
* sizeof(NSObject)=4 | |
* elapsed time of [NSObject alloc] = 0.235727 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syn keyword CocoaClass NSString NSArray NSSet NSDictionary NSNumber NSInteger NSDate | |
syn keyword UIKitClass UIView UITableView UITableViewCell UINavigationController UIViewController UIApplication UITableViewController UIColor UIToolbar UIBarButtonItem | |
syn keyword CGStruct CGRect CGFloat | |
syn keyword CGMethod CGRectMake | |
HiLink CocoaClass objcType | |
HiLink UIKitClass objcType | |
HiLink CGStruct Type | |
HiLink CGMethod Function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int gcd(int i, int j, int n) | |
{ | |
while (i != j) { | |
if (i > j) | |
i -= j; | |
else | |
j -= i; | |
} | |
return i * n; | |
} |
OlderNewer