上一页 1 ··· 6 7 8 9 10 11 12 13 14 15 下一页
摘要: 1 class Solution { 2 public: 3 int maximumInvitations(vector<int>& favorite) { 4 int n=favorite.size(); 5 vector<int>ind(n); 6 for(int i=0;i<n;i++)ind 阅读全文
posted @ 2022-01-03 11:34 matt-11 阅读(127) 评论(0) 推荐(0)
摘要: 1 class Solution { 2 public: 3 int lastRemaining(int n, int m) { 4 if(n==1)return 0; 5 return (m%n+lastRemaining(n-1,m))%n;//以m%n为参考系,当成0,求得n-1的解再换系;也 阅读全文
posted @ 2021-12-31 19:40 matt-11 阅读(28) 评论(0) 推荐(0)
摘要: 1 const int N=1e5+5; 2 class Solution { 3 public: 4 int ch[N][26]; 5 vector<string> findAllConcatenatedWordsInADict(vector<string>& words) { 6 unorder 阅读全文
posted @ 2021-12-31 17:45 matt-11 阅读(29) 评论(0) 推荐(0)
摘要: 1 class Solution { 2 public: 3 const int N=1e5+5; 4 vector<long long> getDistances(vector<int>& arr) { 5 int n=arr.size(); 6 vector<int>v[N]; 7 vector 阅读全文
posted @ 2021-12-30 17:53 matt-11 阅读(42) 评论(0) 推荐(0)
摘要: 1 class Solution { 2 public: 3 vector<int> recoverArray(vector<int>& nums) { 4 multiset<int>s; 5 int n=nums.size(); 6 sort(nums.begin(),nums.end()); 7 阅读全文
posted @ 2021-12-30 17:41 matt-11 阅读(51) 评论(0) 推荐(0)
摘要: 1 #include<bits/stdc++.h> 2 using namespace std; 3 const int N=1e3+5; 4 int px[N],py[N],x[N],y[N],r[N]; 5 bitset<N>bt[N],t; 6 long long pow_x(int x) 7 阅读全文
posted @ 2021-12-30 15:36 matt-11 阅读(51) 评论(0) 推荐(0)
摘要: 1 #include<bits/stdc++.h> 2 using namespace std; 3 4 int main() 5 { 6 int n,ans=0; 7 cin>>n; 8 for(int i=1;i<=(1<<9);i++)//10位数,考虑每位取0.1转成2进制表示 9 { 10 阅读全文
posted @ 2021-12-30 15:04 matt-11 阅读(28) 评论(0) 推荐(0)
摘要: x ≡a1(mod m1)x ≡a2(mod m2)x ≡a3(mod m3)中国剩余定理 x在模m1*...*mn下有唯一解; 其中m1,m2,m3两两互质 M=Πmi;Mi=M/mi;其中 Miyi ≡1(mod m1) ,即yi是Mi模mi的逆; 答案 x=∑aiMiyi 正确性:对于任意 同 阅读全文
posted @ 2021-12-23 20:05 matt-11 阅读(70) 评论(0) 推荐(0)
摘要: leetcode 1044. 最长重复子串 1 typedef unsigned long long ull; 2 const int N=3e4+5; 3 const int mod=1e9+7; 4 const int p=131;//这个取值很重要,17,19都被这题卡了; 5 ull px[ 阅读全文
posted @ 2021-12-23 19:56 matt-11 阅读(113) 评论(0) 推荐(0)
摘要: 1 a*b=lcm[a,b]*gcd(a,b); 2 证明: 3 令lcm[a,b]=c=ab/(a,b); 4 因为a|c , b|c,所以c为a,b的公倍数,所以[a,b]|c; 5 由裴蜀定理 6 存在x,y使得 7 ax+by=(a,b); 8 ax/(a,b)+by/(a,b)=1; 9 阅读全文
posted @ 2021-12-22 17:02 matt-11 阅读(87) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 13 14 15 下一页