http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1045
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <stdio.h> int main() { float c; while ( scanf ( "%f" , &c) && c !=0) { int i = 2; float fResult = 0; while (fResult < c) { fResult += 1.00/i; i++; } printf ( "%d card(s)\n" , i - 2); } return 0; } |