Exemplo n.º 1
0
Arquivo: 038.c Projeto: bobertlo/euler
int main(void) {
	int max = 0;
	int i;
	for (i=1; i < 1000000; i++) {
		// make sure this number itself fits the criterea
		if (composable(EMPTY_DMASK, i) == -1) {
			continue;
		}

		unsigned int acc = i;
		dmask m = set_digits(EMPTY_DMASK, i);
		int j;
		for (j=2; j < 10; j++) {
			int n = i * j;
			int test = composable(m, n);
			if (test == -1) {
				break;
			}
			if (test == 0) {
				acc = int_cat(acc, n);
				if (acc > max) {
					max = acc;
					break;
				}
			}
			acc = int_cat(acc, n);
			m = set_digits(m, n);
			if (acc > 987654321)
				break;
		}
	}
	printf("%i\n", max);
	return 0;
}
Exemplo n.º 2
0
Arquivo: MRPH.c Projeto: Andiry/fxmark
static void set_test_path(struct worker *worker,
			  unsigned int len,
			  unsigned int *digits, const unsigned int *mods,
			  char *path)
{
	struct fx_opt *fx_opt = fx_opt_worker(worker);
	path += sprintf(path, "%s", fx_opt->root);
	set_digits(len, digits, mods, '/', path);
}