Thursday, September 2, 2010

uva 10137

//brr
/*
problem name:uva 10137-The Trip
author:iqbal morshed
status:accepted
runtime:012sec
algorithm:adhoc

hints:1.find the avarage value and round it to two digit after decimal(i.e.if avagrage=9.005 then round to 9.01)
2.find difference from upper value to avarage and accumulate it
3.do the same for lower value to avarage
4.print the minimum
*/
#include
#include
using namespace std;
int tc,i;
double num[10001],sum,avg,change,bigChange,smallChange;
double twoPrecision(double a);
int main()
{
//freopen("input.txt","r",stdin);
while(scanf("%d",&tc)!=EOF)
{
sum=0,change=0,bigChange=0,smallChange=0;
if(tc==0)
break;

for(i=0;iavg)
{
bigChange=bigChange+(num[i]-avg);
}
else
smallChange=smallChange+(avg-num[i]);

}
if(bigChange=5)
temp=temp+10;
temp=temp/10;
avg =(double)temp/100;
return avg;
}

Thursday, February 18, 2010

STARTING NOW

From Now, I've decided to write blog .To share my knowledge ,what i have gained .I believe one of the best way to learn is to teach . So I will try to learn and teach by writting in the blog.