您现在的位置是:主页 > news > 网站中的qq客服怎么做/推广形式有哪几种

网站中的qq客服怎么做/推广形式有哪几种

admin2025/4/28 9:33:01news

简介网站中的qq客服怎么做,推广形式有哪几种,前端网站页面模板,做阿里巴巴企业网站#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);方向迭代器应用于STL c.begin() 返回一个迭代器,它指向容器c的第一个元素 c.end() 返回一个迭代器,它指向容器c的最后一个元素的下一个位置 c.rbegin() 返回一个逆序迭代器&#xff0…

网站中的qq客服怎么做,推广形式有哪几种,前端网站页面模板,做阿里巴巴企业网站#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);方向迭代器应用于STL c.begin() 返回一个迭代器,它指向容器c的第一个元素 c.end() 返回一个迭代器,它指向容器c的最后一个元素的下一个位置 c.rbegin() 返回一个逆序迭代器&#xff0…
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

方向迭代器应用于STL

c.begin() 返回一个迭代器,它指向容器c的第一个元素

c.end() 返回一个迭代器,它指向容器c的最后一个元素的下一个位置

c.rbegin() 返回一个逆序迭代器,它指向容器c的最后一个元素

c.rend() 返回一个逆序迭代器,它指向容器c的第一个元素前面的位置

关于cout<<’\n’的使用

不要使用cout<<endl操作,因为每执行一次cout<<endl,缓冲区会被刷新一次,效率很低,改为cout<<’\n’;就好了

判断素数

int check(int a)
{for(int i = 2; i * i <= a ; i ++)if(a % i == 0)	return 0;return 1;	
}

判断回文数

bool check(int x)
{int y=x,num=0;//int y=x,防止x被改变while (y!=0){num=num*10+y%10;//上一次数字的记录进位再加上下一位数y/=10;} if (num==x) return 1;else return 0;
}

求最小公倍数、最大公倍数

求两个数字之间

1.枚举法

#include<iostream>
using namespace std;
int a,b,c,i;
int main()
{cin>>a>>b;c = min(a,b) ;       //c存最小的数for(i=c;i>0;i--)  //从c到0枚举找最大公约数{if(a%i==0 && b%i==0)break;}cout<<"最大公约数:"<<i<<endl;cout<<"最小公倍数:"<<a*b/i; //最大公倍数 = 两数相乘 / 最小公约数return 0;
}

2.递归法

#include<iostream>
using namespace std;
int a,b,c;int gcd(int a,int b)
{if(a%b==0) return b;else return gcd(b,a%b); //递归
}int main()
{cin>>a>>b;cout<<"最大公约数:"<<gcd(a,b)<<endl;cout<<"最小公倍数:"<<a*b/gcd(a,b); //最大公倍数 = 两数相乘 / 最大公约数
}

3.欧几里得算法(辗转相除法)

int gcd(int a,int b)
{return b ? gcd(b, a % b) : a;	
} 

求n个数字之间

#include<iostream>
using namespace std;
const int N = 1010;int gcd(int x,int y)
{return y ? gcd(y,x%y):x ;	  
} 
int main()
{int n,a[N]; //a存储n个数字cin >> n;for(int i = 0;i < n ;i++) cin >> a[i];int max = a[0]*a[1]/gcd(a[0],a[1]); // 最大公约数 int min = gcd(a[0],a[1]);//  最小公倍数 for(int i = 2;i < n;i++){max = max*a[i]/gcd(max,a[i]);min = gcd(min,a[i]);}cout << n << "个数的最大公约数" << max << endl;cout << n << "个数的最小公倍数" << min << endl; return 0;
}

用指针复制字符串

#include<stdio.h>int main()
{char s1[80],s2[80],*p1,*p2;gets(s1);p1=s1;p2=s2;while(*p1!='\0') {*p2++=*p1++;}*p2='\0';puts(s2);return 0;
}

lower_bound()和upper_bound()

lower_bound( )和upper_bound( )都是利用二分查找的方法在一个排好序的数组中进行查找的。

在从小到大的排序数组中,

lower_bound( begin,end,num):从数组的begin位置到end-1位置二分查找第一个大于或等于num的数字,找到返回该数字的地址,不存在则返回end。通过返回的地址减去起始地址begin,得到找到数字在数组中的下标。

upper_bound( begin,end,num):从数组的begin位置到end-1位置二分查找第一个大于num的数字,找到返回该数字的地址,不存在则返回end。通过返回的地址减去起始地址begin,得到找到数字在数组中的下标。

在从大到小的排序数组中,重载lower_bound()和upper_bound()

lower_bound( begin,end,num,greater() ):从数组的begin位置到end-1位置二分查找第一个小于或等于num的数字,找到返回该数字的地址,不存在则返回end。通过返回的地址减去起始地址begin,得到找到数字在数组中的下标。

upper_bound( begin,end,num,greater() ):从数组的begin位置到end-1位置二分查找第一个小于num的数字,找到返回该数字的地址,不存在则返回end。通过返回的地址减去起始地址begin,得到找到数字在数组中的下标。

#include<bits/stdc++.h>
using namespace std;
const int maxn=100000+10;
const int INF=2*int(1e9)+10;
#define LL long long
int cmd(int a,int b){return a>b;
}
int main(){int num[6]={1,2,4,7,15,34}; sort(num,num+6);                           //按从小到大排序 int pos1=lower_bound(num,num+6,7)-num;    //返回数组中第一个大于或等于被查数的值 int pos2=upper_bound(num,num+6,7)-num;    //返回数组中第一个大于被查数的值cout<<pos1<<" "<<num[pos1]<<endl;cout<<pos2<<" "<<num[pos2]<<endl;sort(num,num+6,cmd);                      //按从大到小排序int pos3=lower_bound(num,num+6,7,greater<int>())-num;  //返回数组中第一个小于或等于被查数的值 int pos4=upper_bound(num,num+6,7,greater<int>())-num;  //返回数组中第一个小于被查数的值 cout<<pos3<<" "<<num[pos3]<<endl;cout<<pos4<<" "<<num[pos4]<<endl;return 0;	
} 

next_permutation函数及手动实现。

对于给定的某个排列,我们想求出比它大的最小的排列。
可以从后往前遍历这个排列,找到第一个可以让排列的字典序变大的位置。

只有当序列单调下降时,它才不存在更大的排列,因此我们要找的位置就是第一次出现 ak−1<aka_{k−1}<a_kak1<ak 的位置。

那么此时将 ak−1a_{k−1}ak1 变成比它大的最小数,然后将剩余部分从小到大排序,得到的排列就是比原排列大的最小排列了。

这里有个小优化:

由于 ak−1a_{k−1}ak1 后面的部分已经从大到小排好序,因此只需将其翻转,就可以得到从小到大排序的结果了,不需要使用 sort函数,时间效率可以降到线性。
时间复杂度
一共求 mmm 次next_permutation,每次需要 o(n)o(n)o(n) 的时间,因此总时间复杂度是 O(nm)O(nm)O(nm)

for(int i = 0; i < n; i++) cin >> a[i];
//while(m--) next_permutation(a,a+n);  //直接函数实现
while (m -- ) //手动实现全排列{int k = n - 1;while (a[k - 1] > a[k]) k -- ; //从最后一位开始找较小的数k -- ;int t = k;//t标记该位置while (t + 1 < n && a[t + 1] > a[k]) t ++ ;//找到位于k后面的比q[k]小的位置swap(a[t], a[k]);reverse(a + k + 1, a + n);}
#include <cctype>的函数isalnum()   如果参数是字母数字,即字母或数字,该函数返回true
tolower()/toupper()     如果参数是()大写字符,则返回其()小写,否则返回该参数
isalpha()/isdigit()     如果参数是字母或数字(09),该函数返回真
islower()/isupper()     如果参数是,该函数返回true