標籤:c
這次的題目很經典。
1、Hermite Polynomials
2、求兩個整數最大公約數
3、ATOI
4、可變參數列表的使用
具體的題目在這裡:
題目請見 http://download.csdn.net/download/wangpegasus/5701765
1、
int hermite(int n, int x){if (n < 1){return 1;}elseif (n == 1){return 2 * x;}else{return 2 * x * hermite(n-1, x) - 2 * (n-1) * hermite(n-2, x);}}
2、
int gcd(int M, int N){if (M <= 0 || N <= 0){return 0;}elseif ( M%N == 0 ){return N;}else{return gcd(N, M%N);}}
3、
int ascii_to_integer(char *string){int result;result = 0;while (*string >= '0' && *string <= '9'){result *= 10;result += *string - '0';string++;}while (*string != '\0'){*string <= '0'|| *string >= '9';result = 0;}return result;}
4、
#include "stdarg.h"int max( int n_value, ...){va_list va_arg;int max_value = 0;va_start(va_arg, n_value);for (int i = 0; i < n_value; i++){if (max_value < va_arg(va_arg, int)){max_value = va_arg(va_arg, int);}}va_end(va_arg);return max_value;}