讨论 / 如果今年noip能水到这个程度多好……
577866/1111 2014-09-14 07:25:52
点我顶贴 收藏 删除
如题,求无图论,无动态规划,全部题穷举+贪心……

#include <stdio.h>

#define MON 300

int cost[12];

int save=0;

int moninhand=0;

void read();

int calculate();

int main()

{

read();

printf("%d",calculate());

return (0);

}

void read()

{

extern int cost[12];

int i;

for(i=0;i<12;i++)

scanf("%d",&cost[i]);

}

int calculate()

{

extern int cost[12];

extern int save,moninhand;

int month;

for(month=1;month<=12;month++)

{

moninhand=moninhand+MON-cost[month-1];

if(moninhand<0)

return (0-month);

else

{

save=save+100*(moninhand/100);

moninhand=moninhand-100*(moninhand/100);

}

}

return (moninhand+120*(save/100));

}

果断AC100……

查看更多回复
提交回复