#include <stdio.h>
int main()
{
int n,s[6],a,i;
while (scanf("%d",&n)&&n)
{
for (i=0;i<n;i++)
{
scanf("%d",&s[i]);
a=s[i]/100;
a=a+s[i]%100/50;
a=a+s[i]%100%50/10;
a=a+s[i]%100%50%10/5;
a=a+s[i]%100%50%10%5/2;
a=a+s[i]%100%50%10%5%2/1;
}
printf("%d\n",a);
}
return 0;
}
3 回答
已采纳
如果没有如果5
TA贡献3条经验 获得超3个赞
需要小改一下
#include <stdio.h> int main() { int n,s[6],a=0,i; while (scanf("%d",&n)&&n) { for (i=0;i<n;i++) { scanf("%d",&s[i]); a+=s[i]/100; a=a+s[i]%100/50; a=a+s[i]%100%50/10; a=a+s[i]%100%50%10/5; a=a+s[i]%100%50%10%5/2; a=a+s[i]%100%50%10%5%2/1; } printf("%d\n",a); } return 0; }
- 3 回答
- 0 关注
- 1890 浏览
添加回答
举报
0/150
提交
取消