ZOJ1045&&1048

简介:
两道简单题,此外,1049有网友给出的计算公式是 Z=3.14*(x*x+y*y)/100.0+1.0,可惜我不明白其原理

ZOJ1045 HangOver

复制代码
#include<iostream>
using namespace std;
int main()
{
    double target,num,sum;
    while(cin>>target&&target!=0.00)
    {
        sum = 0.0f;
        num = 2;
        while(sum<target)
        {
            sum += 1.0/num;
            num++;
        }
        cout<<num-2<<" card(s)"<<endl;
    }
    return 0;
}
复制代码
 ZOJ1048 Financial Management

复制代码
#include<iostream>
using namespace std;
int main()
{
    double sum = 0.0f,average = 0.0f,num;
    for (int i=0;i<12;++i)
    {
        cin>>num;
        sum += num;
    }
    average = sum/12.0f;
    cout<<"$"<<average<<endl;
    return 0;
}
复制代码




本文转自Phinecos(洞庭散人)博客园博客,原文链接:http://www.cnblogs.com/phinecos/archive/2008/10/23/1318249.html,如需转载请自行联系原作者
目录
相关文章
|
机器学习/深度学习
POJ 1775 (ZOJ 2358) Sum of Factorials
POJ 1775 (ZOJ 2358) Sum of Factorials
143 0
|
人工智能 BI 应用服务中间件
|
机器学习/深度学习
|
Java 测试技术 C++
HDU 3783 ZOJ
ZOJ Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2779    Accepted Submission(s): 1840 Problem Description 读入一个字符串,字符串中包含ZOJ三个字符,个数不一定相等,按ZOJ的顺序输出,当某个字符用完时,剩下的仍然按照ZOJ的顺序输出。
1103 0
|
人工智能 机器学习/深度学习
POJ 1775 (ZOJ 2358) Sum of Factorials
Description John von Neumann, b. Dec. 28, 1903, d. Feb. 8, 1957, was a Hungarian-American mathematician who made important contributions t...
1143 0
|
人工智能 BI JavaScript
POJ 2260(ZOJ 1949) Error Correction 一个水题
Description A boolean matrix has the parity property when each row and each column has an even sum, i.
1164 0