Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

ac打卡

Posted by ck1994 at 2018-08-03 10:47:06 on Problem 1003
#include <iostream>

using namespace std;

double cal(int n)
{
    float sum=0;
    for (int i=2;i<=n+1;i++)
    {
        sum = sum + (1.0/i);
        //cout<<1.0/i<<"**"<<endl;
        
    }
    return sum;
    
}

int main()
{
    double m;
    cin>>m;
    while(m!=0)
    {
        for(int i=0;i<300;i++)
        {
            if(cal(i)>=m)
            {
                cout<<i<<" card(s)"<<endl;
                break;
            }
        }
        
        cin>>m;
    }
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator