摘要:
比较难,没怎么看懂 //约数: //如果一个数d是n的一个约数,即d能整除n,那么n/d也能整除n: //求所有约数(除法求约数,o(sqrt(n))) #include<bits/stdc++.h> using namespace std; const int N=1e5+10; int n,x; 阅读全文
posted @ 2023-06-13 19:53
o-Sakurajimamai-o
阅读(71)
评论(0)
推荐(0)
摘要:
// 最基本求一个素数(on),(osqrt(n)) #include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; for(int i=2;i<n;i++)//o(n) if(n%i==0){ cout<<"no"; 阅读全文
posted @ 2023-06-13 14:09
o-Sakurajimamai-o
阅读(46)
评论(0)
推荐(0)
摘要:
给出一个长为n的只由'1','2','0'组成的字符串,要求改动最少的位置,使'1','2','0'的个数相同(保证n能被3整除),并使改动后的字符串字典序最小。 n不大于3∗105 贪心思路,从左向右大的变小的,从右向左小的变大的: #include<bits/stdc++.h> using na 阅读全文
posted @ 2023-06-13 11:38
o-Sakurajimamai-o
阅读(23)
评论(0)
推荐(0)

浙公网安备 33010602011771号