熟悉系统... #include <stdio.h> #define PRECISION 0.001 int main() { float length = 0.0; float i = 2.0; float sum = 0.0; while(scanf("%f", &length) && length != 0.00) { i = 2.0; sum = 0.0; while(length - sum > PRECISION) { sum += 1 / i; i++; } printf("%.f card(s)/n", i - 2); } return 0; }