阿里笔试题一
来源:互联网 发布:vb 数值转换为字符 编辑:程序博客网 时间:2024/06/15 08:34
#include <iostream>#include <vector>#include <numeric>#include <limits>#include <math.h>using namespace std;/** 请完成下面这个函数,实现题目要求的功能 **/ /** 当然,你也可以不按照这个模板来作答,完全按照自己的想法来 ^-^ **/int prime(int num_input){ int flag = 0; for (int i = 2; i < sqrt(num_input); ++i) { if (num_input % i == 0) { flag = 1; return 0; } } return 1;}int count(int num){ int num_count = 0; for (int i = 0; i <= num; ++i) { for (int j = 0; ; ++j) { while(num != 1) { if (prime(j)) { while(num % j == 0) { num = num / j; ++num_count; } } } } } return num_count;}int main() { int res; int _num; cin >> _num; cin.ignore (std::numeric_limits<std::streamsize>::max(), '\n'); res = count(_num); cout << res << endl; return 0;}
0 0
- 阿里笔试题一
- 阿里笔试题(一)
- 阿里2017笔试题(一)
- 阿里笔试题解答(一)
- 阿里2014校园招聘笔试题最后一题答案
- 2015.4.2阿里c/c++实习生笔试最后一题
- 2016年阿里C/C++开发笔试程序题一
- 阿里云笔试题
- 阿里云笔试题
- 阿里2014笔试题
- 阿里笔试题-选择
- 2015阿里笔试题
- 阿里笔试题
- 阿里的笔试题
- 阿里笔试题
- 阿里笔试题
- 阿里笔试大题
- 阿里笔试第一题
- Java基础学习总结——equals方法
- js/jquery 杂七杂八
- getopt解析
- TensorFlow中cnn-cifar10样例代码详解
- 基于 Django1.10 文档的深入学习(13)—— django.core.urlresolvers 之 reverse()
- 阿里笔试题一
- VBA编码几个注意点
- 哈希表
- 【洛谷P3384】【模板】树链剖分
- 操作系统学习笔记(七)
- linux数据类型
- SQL truncate 、delete与drop区别
- 阿里笔试题二
- 文章标题