今天我来分享一下如何利用素数分解定理求解与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
参考网址:https://www.bejson.com (网站文件部分有坑,需要擦亮眼睛) nginx k8s版本:v1.20 apiVersion: apps/v1 kind: Deployment metadata: name: my-nginx namespace: test spec: re ...
分类:
其他好文 时间:
2021-04-26 14:08:07
阅读次数:
0
线程 创建线程 #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
被迫营业。 对于树上的路径统计问题,我们一直存在一个比较暴力的做法,就是从根节点出发,先统计所有以根为 \(\text{lca}\) 的路径,然后依次递归每一棵子树,同时使用上面的方法。这个方法的复杂度显然是 \(O(n^2)\) 的,我们可以轻易的用一条链卡掉,于是问题来了,如果题目让我们统计所有 ...
分类:
编程语言 时间:
2021-04-26 13:15:20
阅读次数:
0
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
转化题目,题目要求的是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
链接:https://pintia.cn/problem-sets/994805046380707840/problems/1336215880692482060 思路: 代码: #include<bits/stdc++.h> using namespace std; vector<int>ve[1 ...
分类:
其他好文 时间:
2021-04-24 13:26:55
阅读次数:
0
考个研真的把很多东西都忘光了,,, #include <string_view> #include <iostream> #include <string> #include <algorithm> #include <vector> using namespace std; class Sampl ...
分类:
其他好文 时间:
2021-04-23 12:18:50
阅读次数:
0
做法:记录每个点i向左与它最近的不互质的数j,从j+1到i是可以分成1块的。 对于每次询问,从r开始一直贪心往前跳,每跳一步ans++;但这样一步一步跳会T,需要去倍增优化。 #include<bits/stdc++.h> using namespace std; #define ll long l ...
分类:
其他好文 时间:
2021-04-23 12:09:38
阅读次数:
0
typeid操作符可以用来获取一个类型/表达式的名称: #include <iostream> #include <typeinfo> using namespace std; int main() { std::cout << typeid(int).name() << std::endl; re ...
分类:
其他好文 时间:
2021-04-23 12:05:50
阅读次数:
0