#include <stdio.h> int binary_search(int ara[], int n, int ara_size) { int min, max, mid; min = 0; max = ara_size - 1; while(min <= max) { mid = min + (max - min) / 2; if(ara[mid] == n) { return 1; } else if(ara[mid] < n) { min = mid + 1; } else { max = mid - 1; } } return 0; } int main() { int N, K, i; int ones_indexes[65536]; // there will be total 65536 ones in the 110100100010001... sequence fo...
#include <stdio.h> int main() { int i, n, k, sum; char input[24]; gets(input); if(input[1] == ' ') { n = input[0] - '0'; i = 2; } else { n = 10; i = 3; } k = i; while(input[i]) i++; k = i - k; sum = 1; for(i = n; i > 0; i -= k) sum *= i; printf("%d", sum); return 0; }
Comments
Post a Comment