亲!杭电acm2021无法ac!!! http://acm.hdu.edu.cn/showproblem.php?pid=2021
#include"stdio.h"intmain(){intn,m,i,a[100],total[100];intb,f,s,w,e,y;while(scanf("%d\...
#include"stdio.h"
int main()
{
int n,m,i,a[100],total[100];
int b,f,s,w,e,y;
while(scanf("%d\n",&n)!=EOF)
{
if(n<=0||n>100)
break;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{b=0;f=0;s=0;w=0;e=0;y=0;
b=a[i]/100;
f=(a[i]-100*b)/50;
s=(a[i]-100*b-50*f)/10;
w=(a[i]-100*b-50*f-10*s)/5;
e=(a[i]-100*b-50*f-10*s-5*w)/2;
y=a[i]-100*b-50*f-10*s-5*w-2*e;
total[i]=b+f+s+w+e+y;
if(i<n-1)
{
printf("%d",total[i]);
printf(" ");
}
else
printf("%d\n",total[i]);
}
}
return 0;
} 展开
int main()
{
int n,m,i,a[100],total[100];
int b,f,s,w,e,y;
while(scanf("%d\n",&n)!=EOF)
{
if(n<=0||n>100)
break;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{b=0;f=0;s=0;w=0;e=0;y=0;
b=a[i]/100;
f=(a[i]-100*b)/50;
s=(a[i]-100*b-50*f)/10;
w=(a[i]-100*b-50*f-10*s)/5;
e=(a[i]-100*b-50*f-10*s-5*w)/2;
y=a[i]-100*b-50*f-10*s-5*w-2*e;
total[i]=b+f+s+w+e+y;
if(i<n-1)
{
printf("%d",total[i]);
printf(" ");
}
else
printf("%d\n",total[i]);
}
}
return 0;
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询