昨天开始在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;
}