POJ Volume1练习记录

昨天开始在POJ上做题,作为菜鸟,先做简单的咯,争取天天都做吧,Hang on~


1003

#include<iostream>
using namespace std;
/*
*POJ 1003
*Author :Biang Hoo
*July 27 2013
*/
int main(){

	double c;
	while(cin>>c&& c !=0.00){
		double sum=0.00;
		int i=2;
		while(sum<c){
			sum += (1.0/i);
			i++;
		}
		cout<<(i-2)<<" card(s)"<<endl;
	}
	return 0;
}

1004 


#include<iostream>
using namespace std;
/*
*POJ 1004
*Author :Biang Hoo
*July 27 2013
*/
int main(){
	int i=0;
	double balance;
	double avg =0.0;
	while(cin>>balance && balance !=0 && i != 12){
		i++;
		avg += balance;

	}
	cout<<"$"<<(avg/12.00)<<endl;
	return 0;
}

1005
#include<iostream>
#include<math.h>
using namespace std;
/*
*POJ 1005
*Author :Biang Hoo
*July 27 2013
*/
int main(){
	int i;
	float x;
	float y;
	float area;
	cin>>i;
	for(int j=0;j<i;j++){
		cin>>x>>y;
		float r2 =x*x+y*y;
		area = (3.14*r2)/2;
		float year =ceil(area/50.0);
		cout<<"Property "<<(j+1)<<": This property will begin eroding in year "<<year<<"."<<endl; 
	}
	cout<<"END OF OUTPUT."<<endl;
	return 0;
}

1006

#include<iostream>
using namespace std;
/*Poj 1006
*Author Biang Hoo
*July 28 2013
*/
int main(){
	int p,e,i,d;
	int Case = 0;
	while(cin>>p>>e>>i>>d&& p != -1 && e != -1 && i != -1 && d != -1&&d <= 365){
		Case++;
		int peak=1;
		bool flag = false;
		while(!flag){
			if((peak-p)%23 == 0 && peak != d ){
				if((peak-e)%28 == 0){
					if((peak-i)%33==0){
						if(peak-d>0){
							flag = true;
							break;
						}
					}
				}
			}
			peak++;
		}
			cout<<"Case "<<Case<<": the next triple peak occurs in "<<(peak-d)<<" days."<<endl;
	}
	return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值