讨论 / 1的差距啊!!!学C用int太不方便!!!!
lemontree712 2013-11-08 19:42:27
点我顶贴 收藏 删除
0分!!:

#include <stdio.h>

int main (){

int can=0,memo=0,i,a[12],sum;

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

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

}

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

{can+=300;

can-=a[i];

if ((can/100)>=1)

{memo+=can/100*100;

can%=100;

}

if (can<0)

{printf ("-%d",i);return 0;}

}

memo*=1.2;

sum=memo+can;

printf ("%d",sum);

return 0;

}

100分AC程序:

#include <stdio.h>

int main (){

int can=0,memo=0,i,a[12],sum;

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

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

}

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

{can+=300;

can-=a[i];

if ((can/100)>=1)

{memo+=can/100*100;

can%=100;

}

if (can<0)

{printf ("-%d",i+1);return 0;}

}

memo*=1.2;

sum=memo+can+1;

printf ("%d",sum);

return 0;

}

查看更多回复
提交回复