https://www.luogu.com.cn/problem/P2005 高精度除法 模板题,居然发现还没填上小学时高精除高精的坑(一定是我太菜了) 用减法模拟除法,只要大于除数,就暴力减,这一位的$ans++$ \(C++ Code:\) #include<cstdio> #include<i ...
                            
                            
                                分类:
其他好文   时间:
2020-07-29 21:16:06   
                                阅读次数:
54
                             
                         
                    
                        
                            
                            
                                    Little W and Contest 思路:首先很显然是并查集去维护答案。 一开始,所有点都是独立的。那么设CF1 = 1的总个数。CF2 = 2的总个数 那么一开始ans = C(CF1,1)*C(CF2,2)+C(CF2,3). 那么考虑合并后怎么维护答案。 这里运用了容斥思想。 当我们合并 ...
                            
                            
                                分类:
其他好文   时间:
2020-07-29 10:20:09   
                                阅读次数:
65
                             
                         
                    
                        
                            
                            
                                #include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=3e5+100; const int mod=998244353; ll fpow (int x,int y) { ll ans=1;  ...
                            
                            
                                分类:
其他好文   时间:
2020-07-18 22:52:12   
                                阅读次数:
105
                             
                         
                    
                        
                            
                            
                                    给定一个n表示a的质因数个数。 接下来n行给出质数及其指数。 按要求输出其因数,满足如下要求: 当前数是前一个数通过乘一个质数或者除以一个质数得到。 反正就是构造嘛。对于每一个i,必然要遍历前面的所有情况。其实就是升升降降。 vector<ll> ans; vector<ll> p(16); vec ...
                            
                            
                                分类:
其他好文   时间:
2020-07-18 11:22:49   
                                阅读次数:
70
                             
                         
                    
                        
                            
                            
                                    1 class Solution { 2 public int searchInsert(int[] nums, int target) { 3 int length = nums.length; 4 int left = 0, right = length - 1, ans = 0; 5 whil ...
                            
                            
                                分类:
其他好文   时间:
2020-07-18 00:57:17   
                                阅读次数:
92
                             
                         
                    
                        
                            
                            
                                    叉乘,点乘,用结构体存cos^2 int n, ans = 1, X[N], Y[N]; struct node { double x,y; node(): node(0,0){} node(double x,double y):x(x),y(y){} bool operator < (const  ...
                            
                            
                                分类:
其他好文   时间:
2020-07-16 11:50:55   
                                阅读次数:
66
                             
                         
                    
                        
                            
                            
                                链接:https://leetcode-cn.com/problems/subsets-ii/ 代码 class Solution { public: vector<vector<int>> ans; vector<int> path; vector<vector<int>> subsetsWith ...
                            
                            
                                分类:
其他好文   时间:
2020-07-16 00:27:10   
                                阅读次数:
75
                             
                         
                    
                        
                            
                            
                                    题:https://ac.nowcoder.com/acm/contest/5667/G 题意:给定n个数的数组A,m个数的数组B,问在A中有多少个子数组满足Si>=Bi 分析:我们可以考虑记录合法子数组以数组A中的一个位置代表一个合法子数组(因为长度固定为m); 设bitset 的ans和tmp, ...
                            
                            
                                分类:
其他好文   时间:
2020-07-14 16:42:37   
                                阅读次数:
289
                             
                         
                    
                        
                            
                            
                                https://www.luogu.com.cn/problem/P2089 1 #include<bits/stdc++.h> 2 using namespace std; 3 int n, cnt=0, ans[60000][10];//最多情况是3^10= 59049,所以开这么大二维数组,用 ...
                            
                            
                                分类:
其他好文   时间:
2020-07-14 15:05:48   
                                阅读次数:
388
                             
                         
                    
                        
                            
                            
                                    给定一个十进制下的正整数 n,若 n 的各位数字之和是一位数,则这个和是 n 的数根。例如,999 的数根为 9,因为 9+9+9=27,2+7=9。给定 n,请输出它的数根。 这样的话,和计算一个数的位数方法差不多 ans=n; a=n; n=0; while(ans>=10)//如果ans是个位 ...
                            
                            
                                分类:
其他好文   时间:
2020-07-11 19:37:28   
                                阅读次数:
55