Source Code
Problem: 1003 | User: cug_fish2008 | |
Memory: 292K | Time: 0MS | |
Language: C++ | Result: Accepted |
- Source Code
#include <iostream> using namespace std; class Node { public: Node(){f=0.00;} public: float f; Node *next; }; int main() { Node *start,*pass; pass=new Node; start=pass; float fm; do { cin>>fm; pass->f=fm; pass->next=new Node; pass=pass->next; }while(fm!=0.00); while(start->f!=0.00) { int i=0; float sum=0.00; int n=2; for(;start->f>sum;i++) { sum+=1.00/n;n++; } cout<<i<<" card(s)"<<endl; start=start->next; } return 0; }