首页 > 代码库 > poj: 1003

poj: 1003

简单题

 1  #include <iostream> 2  #include <stdio.h> 3  #include <string.h> 4  #include <stack> 5  using namespace std; 6  7  int main() 8  { 9      double c;10      while (cin >> c && c != 0.00) {11         double L = 0.5;12         int n = 1;13         //cout << c << endl;14         while (L < c) {15             n++;16             L += 1 / ((double)n + 1);17             //cout << "L = " << L << endl;18         }19         cout << n << " card(s)" << endl;20      }21      return 0;22  }

 

poj: 1003