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
#include <stdio.h> | |
#include <stdlib.h> | |
static unsigned int fib(unsigned int param) | |
{ | |
if (param < 0) { | |
return 0; | |
} | |
if (param == 1 || param == 2) { | |
return 1; |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
static unsigned int fib(int param) | |
{ | |
assert(param > 0); | |
int f1, f2, f3 = 0; | |
int 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
#include <stdio.h> | |
#include <stdlib.h> | |
/* | |
* a と b の最大公約数を求める関数 gcd | |
* a と b が負の数でも通用する。 | |
* | |
* ---- | |
* | |
* これは、以下が自明であることを利用している |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
/* | |
* 分数型 | |
*/ | |
struct fraction { | |
int numerator; /* 分子 */ | |
int denominator; /* 分母 */ |
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
/** | |
* 標準入力を1文字ずつ受け取り、それらを繋ぎ合わせて | |
* 整数として出力するプログラム 実行例は以下のとおり。 | |
* | |
* $ gcc convert_stdin_tointeger.c -o input2int | |
* $ ./input2int | |
* input one number (space to exit):- <= 最初の桁は + と - の入力可(数値でもよい) | |
* input one number (space to exit):1 | |
* input one number (space to exit):2 | |
* input one number (space to exit): <= input space |
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
#include <stdio.h> | |
/* | |
* param の num 乗を出力する関数(二進累乗法の実装) | |
* | |
* TODO: オーバーフロー/アンダーフローのチェックをしていない | |
* TODO: num が負の時に対応していない | |
*/ | |
static void power(double param, long long int num) | |
{ |
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
#include <stdio.h> | |
/* | |
* int を2進表記にして出力する | |
* int を 32bit と仮定している | |
*/ | |
int binary(int num) | |
{ | |
// | |
// - 以下のルーチンでint の範囲に収まる値は扱うことができるが |
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
#!/bin/sh | |
export LANG=C | |
testURLContentsChange() | |
{ | |
sysctl xen.independent_wallclock=1 | |
TEST_URL="http://www.example.com/" | |
TODAY_START_DATE=`date +'%Y-%m-%d 00:00:00'` |
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
import java.io.StringWriter; | |
import org.apache.velocity.VelocityContext; | |
import org.apache.velocity.Template; | |
import org.apache.velocity.app.Velocity; | |
import org.apache.velocity.exception.ResourceNotFoundException; | |
import org.apache.velocity.exception.ParseErrorException; | |
import org.apache.velocity.exception.MethodInvocationException; | |
import java.util.Vector; | |
/** |
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
package com.example.ini; | |
import java.io.File; | |
import java.io.IOException; | |
import java.util.Set; | |
import java.util.prefs.BackingStoreException; | |
import java.util.prefs.Preferences; | |
import org.ini4j.Ini; | |
import org.ini4j.IniPreferences; |