vector
#include<bits/stdc++.h>
using namespace std;
vector<string>v;
typedef long long ll;
ll n,i,j,temp,cnt;
string jj;
int main(){
cin>>n;
for(i=1;i<=n;i++){
cin>>j;
temp=j;
while(temp!=0){
cnt++;
if(i%2!=0){
if(temp%2==0){
temp-=3;}
else temp-=1;
}
if(i%2==0){
if (temp%2==0){
temp-=2;
}
else temp-=1;
}
}
if(cnt%2==0){
v.push_back("Bob") ;
}
else
v.push_back("Alice");
}
vector<string>::iterator jj;
for(jj=v.begin();jj!=v.end();jj++){
cout<<*jj<<" ";
}
return 0;
}
pair
#include<iostream>
#include<utility>
#include<string>
using namespace std;
int main(){
pair<int,string>pa;
pa.first=233;
pa.second="wsx";
cout<<pa.first<<" "<<pa.second<<endl;
pair<int,int>pc=make_pair(1,1);
pair<int,int>pd=make_pair(1,2);
if(pc>pd)
cout<<"1";
else
cout<<"0";
return 0;
}
//分治法求最大子段和
#include<map>
#include<vector>
#include<cmath>
#include<iostream>
using namespace std;
typedef long long ll;
const int N=100000+5;
int n=10,a[N]={2,-7,6,-2,8,-2,9,6,-1,-2};
int f(int l,int r){
int m=(l+r)/2;
int suml=0;int ansl=a[m];
int sumr=0;int ansr=a[m+1];
for(int i=m;i>=1;i--){
suml+=a[i];//字串和左
ansl=max(ansl,suml);//每一次的遍历数字
}
for(int i=m+1;i<=r;i++){
sumr+=a[i];
ansr=max(ansr,sumr);
}
return ansl+ansr;
}
//递归的本质自己调用自己
int maxsum(int l,int r){
if(l==r) return a[l];//出口一定会经过
else{
int m=(l+r)/2;
int L=maxsum(l,m);//走n次这里 m的值赋给r
int R=maxsum(m+1,r);//下一个走n次这里
int LR=f(l,r);//找中间 下下一个走这里n次 函数套函数
return max(max(L,R),LR) ;//最后的结果
}
}
int main(){
cout<<maxsum(0,9)<<endl;//给函数赋值
return 0;
}