码迷,mamicode.com
首页 >  
搜索关键字:include    ( 84546个结果
利用质因数分解定理求与n互质的数的个数
今天我来分享一下如何利用素数分解定理求解与n互质的数的个数。 下面是代码 #include<bits/stdc++.h> using namespace std; long long fun(int x) { long long ans=x; int t=sqrt(x); int cnt; for( ...
分类:其他好文   时间:2021-04-26 14:12:06    阅读次数:0
数据结构-数组
任务 输入N个整数,存入数组,实现以下函数: 实现数组内容原地逆置; 找出数组中的最大元素与第一个元素交换; 输出数组元素的值 编写一个主程序,测试以上3个函数。 代码实现 #include<stdio.h> void swap(int array[], int indexF, int indexS ...
分类:编程语言   时间:2021-04-26 14:01:19    阅读次数:0
定时器
头文件 #include <signal.h> #include <time.h> 创建定时器 int timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid); ...
分类:其他好文   时间:2021-04-26 13:55:59    阅读次数:0
muduo 库解析之十一:Thread
线程 创建线程 #include <pthread.h> int pthread_create(pthread_t *restrict thread,const pthread_attr_t *restrict attr,void *(*start_routine)(void*), void *re ...
分类:其他好文   时间:2021-04-26 13:53:31    阅读次数:0
选第k小元素:特定分治策略
问题 在一堆数组当中,选出第k小的数组 分析 在一般的情况下面,要选择第k小的数组,要先给它进行排序,排序至少需要O(n * logn)的时间复杂度,但是我们可以用分治的思想,相当于快排,给它进行分组,一组一组的进行排序,虽然也是排序,但是时间复杂度可以到达O(n)。 #include<bits/s ...
分类:其他好文   时间:2021-04-26 13:22:43    阅读次数:0
Leetcode/数学/计数质数
质数的算法: 1,判断n是否能被2~n-1整除 输入的数n不能被2-(n-1)整除,说明是素数 输入的数n能被2-(n-1)整除,说明不是素数 #include<stdio.h> int main() { int i, n; bool i; printf("please input a number ...
分类:其他好文   时间:2021-04-26 13:14:06    阅读次数:0
c++(继承 &&菱形继承)
c++(继承 &&菱形继承) #define _CRT_SECURE_NO_WARNINGS #include <iostream> using namespace std; class Animal { public: int m_Age; }; class Sheep :virtual publ ...
分类:编程语言   时间:2021-04-26 13:09:57    阅读次数:0
C++11的enable_shared_from_this
c++11 中的 shared_from_this() 来源于 boost 中的 enable_shared_form_this 类和 shared_from_this() 函数,功能为返回一个当前类的 std::share_ptr,使用方法如下: #include<memory> class Te ...
分类:编程语言   时间:2021-04-26 13:06:17    阅读次数:0
CF208E Blood Cousins(树上启发式合并)
转化题目,题目要求的是K级祖先,我们可以对于每个询问先跳到祖先,那么就是求对于这个祖先,depth[u]+k的个数是多少个,然后-1就是答案 #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair ...
分类:其他好文   时间:2021-04-24 13:41:24    阅读次数:0
I/O复用
select #include<sys/select.h> int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, struct timeval* timeout); // 被监听的文件描述符的总数,可读、 ...
分类:其他好文   时间:2021-04-24 13:30:52    阅读次数:0
84546条   上一页 1 ... 37 38 39 40 41 ... 8455 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!