QvQ


私信TA

用户名:927937414

访问量:28325

签 名:

还是好好学习吧

等  级
排  名 77
经  验 9422
参赛次数 9
文章发表 44
年  龄 19
在职情况 学生
学  校
专  业 软件工程

  自我简介:

还没学算法的弱鸡

解题思路:

注意事项:

参考代码:

#include <iostream>
using namespace std;
int main(){
	int n,t;
	while(cin>>n&&n){
		int count=0;
		for(int i=0;i<n;i++){
			cin>>t;
			while(t){
				if(t>=100){
					t-=100;
					count++;
				}
				else if(t>=50){
					t-=50;
					count++;
				}
				else if(t>=10){
					t-=10;
					count++;
				}
				else if(t>=5){
					t-=5;
					count++;
				}	
				else if(t>=2){
					t-=2;
					count++;
				}
				else {
					t-=1;
					count++;
				}
			}
		}
		cout<<count<<endl;
	}
	return 0;	
}


 

0.0分

2 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区

这是c?
2018-11-25 12:19:17
  • «
  • 1
  • »