/16是个截点
从16开始往下截就行
贪心的思想
#include "stdio.h"
void output(int sum)
{
if( sum % 10)
printf("%d.%d\n",sum/10,sum%10);
else
printf("%d\n",sum/10);
}
int main()
{
int len , sum , flag;
while(scanf("%d",&len) && len)
{
flag = 0;
sum = 0;
while(len >= 16)
{
sum += 360;
len -= 16;
flag = 1;
}
if(len == 0)
{
output(sum);
continue ;
}
if(flag && len <= 5)
{
sum += len*24;
output(sum);
continue ;
}
if(len <= 4)
sum += 100;
else if(len <= 8)
sum += 100 + (len-4)*20;
else if( len <= 13)
sum += 180 + (len-8)*24;
else
sum += 280 + (len-12)*20;
output(sum);
}
return 0;
}