#include #include int gcd(int a, int b) { while (a != 0) { int c = a; a = b%a; b = c; } return (b<0) ? -b : +b; } #define MAX 10001 int a[MAX]; int main() { memset(a, 0, sizeof(a)); a[0] = 1; for (int n=0; n