C11SEQ3 - Dãy số

Tác giả: happyboy99x

Ngôn ngữ: C++

#include<cstdio>

int f[] = {1, 2, 4, 8, 16, 23, 46, 29, 58, 116, 223, 446, 289, 578, 1156, 1223, 2446, 2489, 4789, 5789, 11578, 12356, 12247, 24449, /**/48889/**/, 77789, 155578, 111356, 122227, 244445};

int main() {
	int n; scanf("%d", &n);
	if(n <= 24) printf("%d\n", f[n-1]);
	else printf("%d\n", f[(n - 25) % 6 + 24]);
	return 0;
}

Download