您的位置:首页 > 其它

pku 1003

2010-06-16 20:14 288 查看
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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  float user c