コード例 #1
0
ファイル: ways.c プロジェクト: Batov/FirstYear
int seach(int i, int j)
{
	int answ;
	if ((i == 0) || (j == 0) || (i == -1) || (j == -1)) answ = 1;
	else answ = seach(i, j - 1) + seach(i - 1, j);
	return answ;
}
コード例 #2
0
ファイル: ways.c プロジェクト: Batov/FirstYear
int main()
{
	int i, j, a;
	printf(">>>");
	scanf("%d", &i);
	scanf("%d", &j);
	a = seach(i, j);
	printf("%d", a);
	return 0;
}
コード例 #3
0
ファイル: Dent.cpp プロジェクト: hal1437/Procon26
double Dent::Execution(const Field& field,const Problem& prob){
	int score = 0;
	
	for(int i=0;i<FIELD_HEIGHT;i++){
		for(int j=0;j<FIELD_WIDTH;j++){
			Point seach(j,i);
			int around=0;
			CLOCKWISE_FOR(clock){
				Point pos = seach+clock;
				if(pos.x >= 0 && pos.x < FIELD_WIDTH &&
				   pos.y >= 0 && pos.y < FIELD_HEIGHT ){
					if(field[pos.y][pos.x]==true)around++;
				}
			}
			if(around >= 2)score++;
		}
	}
	return score;
}