CSP
- 2023-3-3LDAP
- 2022-12JPEG解码
- 2022-9防疫大数据
- 2022-6角色授权
- 2022-3计算资源调度器
- 2021-12登机牌条码
- 2021-9脉冲神经网络
- 2021-4DHCP服务器
- 2020-12带配额的文件系统
- 2020-9点亮数字人生
- 2020-6Markdown渲染器
- 2019-12化学方程式
- 2019-9字符画
- 2019-3损坏的RAID5
- 2018-12CIDR合并
- 2018-9元素选择器
- 2018-3URL映射
- 2017-12Crontab
- 2017-9Json查询
- 2017-3Markdown
- 2016-12权限查询
- 2016-9炉石传说
- 2016-4路径解析
- 2015-12画图
- 2015-9模板生成系统
- 2015-3节日
- 2014-12集合竞价
- 2014-9字符串匹配
- 2014-3命令行选项
- 2013-12最大的矩形
2023-3-3LDAP
0%
#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
using namespace std;
const int N=2510,M=510;
int n,m;
struct p{
int DN,cnt;
}a[N];
int b[N][M*2];
int get(string s)
{
int sum=0;
for(int i=0;i<s.size();i++)
sum=sum*10+s[i]-'0';
return sum;
}
bool check1(int c,int d,int i)
{
for(int j=1;j<=a[i].cnt*2;j+=2)
if(b[i][j]==c&&b[i][j+1]==d)
return true;
return false;
}
bool check2(int c,int d,int i)
{
for(int j=1;j<=a[i].cnt*2;j+=2)
if(b[i][j]==c&&b[i][j+1]!=d)
return true;
return false;
}
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i].DN>>a[i].cnt;
for(int j=1;j<=a[i].cnt*2;j++)
cin>>b[i][j];
}
cin>>m;
while(m--)
{
string s;
cin>>s;
if(s[0]!='&'&&s[0]!='|')
{
int p=s.find(":");
int q=s.find("~");
if(p!=-1) //找到:
{
string s1,s2;
for(int i=0;i<p;i++) s1+=s[i];
for(int i=p+1;i<s.size();i++) s2+=s[i];
int c=get(s1),b=get(s2);
// cout<<a<<' '<<b<<endl;
for(int i=1;i<=n;i++)
if(check1(c,b,i))
cout<<a[i].DN<<' ';
cout<<endl;
}
if(q!=-1)
{
string s1,s2;
for(int i=0;i<q;i++) s1+=s[i];
for(int i=q+1;i<s.size();i++) s2+=s[i];
int c=get(s1),b=get(s2);
// cout<<a<<' '<<b<<endl;
for(int i=1;i<=n;i++)
if(check2(c,b,i))
cout<<a[i].DN<<' ';
cout<<endl;
}
}
}
}
20%
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
using namespace std;
const int N=3000,M=1010;
int a[N][M];
int n,m;
int res[N];
bool check1(int x,int l,int r) // ":'
{
for(int j=1;j<=2*n;j+=2)
if(a[x][j]==l&&a[x][j+1]==r) return true;
return false;
}
bool check2(int x,int l,int r)
{
for(int j=1;j<=2*n;j+=2)
if(a[x][j]==l&&a[x][j+1]!=r) return true;
return false;
}
bool check(int x,string str)
{
// cout<<str<<endl;
int t1=str.find(':'),t2=str.find('~'); //-1
if(t1!=-1)
{
int left=stoi(str.substr(0,t1));
int right=stoi(str.substr(t1+1));
if(check1(x,left,right)) return true;
}
else
{
int left=stoi(str.substr(0,t2));
int right=stoi(str.substr(t2+1));
if(check2(x,left,right)) return true;
}
return false;
}
int main()
{
cin>>n;
for(int i=0;i<n;i++)
{
int DN,cnt;
cin>>DN>>cnt;
a[i][0]=DN;
for(int j=1;j<=2*cnt;j++) cin>>a[i][j];
}
cin>>m;
while(m--)
{
memset(res,0,sizeof res);
int id=0;
string str;
cin>>str;
if(str[0]!='&'&&str[0]!='|')
{
int t1=str.find(':'),t2=str.find('~'); //-1
if(t1!=-1)
{
//int id=0;
int left=stoi(str.substr(0,t1));
int right=stoi(str.substr(t1+1));
for(int i=0;i<n;i++)
if(check1(i,left,right)) res[id++]=a[i][0];//cout<<a[i][0]<<' ';
}
else
{
int left=stoi(str.substr(0,t2));
int right=stoi(str.substr(t2+1));
for(int i=0;i<n;i++)
if(check2(i,left,right)) res[id++]=a[i][0];
}
}
else
{
if(str[0]=='&')
{
for(int i=0;i<n;i++)
{
int u=2,j=2;
while(j<str.size()&&str[j]!=')') j++;
bool f1=check(i,str.substr(u,j-u));
j=j+2,u=j;
while(j<str.size()&&str[j]!=')') j++;
bool f2=check(i,str.substr(u,j-u));
if(f1&&f2) res[id++]=a[i][0];
}
}
else
{
for(int i=0;i<n;i++)
{
int u=2,j=2;
while(j<str.size()&&str[j]!=')') j++;
bool f1=check(i,str.substr(u,j-u));
j=j+2,u=j;
while(j<str.size()&&str[j]!=')') j++;
bool f2=check(i,str.substr(u,j-u));
if(f1||f2) res[id++]=a[i][0];
}
}
}
sort(res,res+id);
if(id>0)
for(int i=0;i<id;i++) cout<<res[i]<<' ';
cout<<endl;
}
}
2022-12JPEG解码
40%
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int T;
const int N=9,M=70;
int Q[N][N];
int n;
int a[M];
int Z[8][8]={
{1,2,6,7,15,16,28,29},
{3,5,8,14,17,27,30,43},
{4,9,13,18,26,31,42,44},
{10,12,19,25,32,41,45,54},
{11,20,24,33,40,46,53,55},
{21,23,34,39,47,52,56,61},
{22,35,38,48,51,57,60,62},
{36,37,49,50,58,59,63,64},
};
int res[N][N];
int main()
{
for(int i=0;i<8;i++)
for(int j=0;j<8;j++)
cin>>Q[i][j];
cin>>n>>T;
for(int i=0;i<n;i++) cin>>a[i];
// cout<<a[64]<<' '<<Z[7][7]<<endl;
for(int i=0;i<8;i++)
for(int j=0;j<8;j++)
res[i][j]=a[Z[i][j]-1];
if(T==0)
{
for(int i=0;i<8;i++)
{
for(int j=0;j<8;j++)
cout<<res[i][j]<<' ';
cout<<endl;
}
return 0;
}
for(int i=0;i<8;i++)
for(int j=0;j<8;j++)
res[i][j]*=Q[i][j];
if(T==1)
{
for(int i=0;i<8;i++)
{
for(int j=0;j<8;j++)
cout<<res[i][j]<<' ';
cout<<endl;
}
return 0;
}
return 0;
}
100%
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int T;
const int N=9,M=70,pai=acos(-1);
int Q[N][N];
int n;
int a[M];
int Z[8][8]={
{1,2,6,7,15,16,28,29},
{3,5,8,14,17,27,30,43},
{4,9,13,18,26,31,42,44},
{10,12,19,25,32,41,45,54},
{11,20,24,33,40,46,53,55},
{21,23,34,39,47,52,56,61},
{22,35,38,48,51,57,60,62},
{36,37,49,50,58,59,63,64},
};
int res[N][N];
double d[N][N];
int main()
{
for(int i=0;i<8;i++)
for(int j=0;j<8;j++)
cin>>Q[i][j];
cin>>n>>T;
for(int i=0;i<n;i++) cin>>a[i];
for(int i=0;i<8;i++)
for(int j=0;j<8;j++)
res[i][j]=a[Z[i][j]-1];
if(T==0)
{
for(int i=0;i<8;i++)
{
for(int j=0;j<8;j++)
cout<<res[i][j]<<' ';
cout<<endl;
}
return 0;
}
for(int i=0;i<8;i++)
for(int j=0;j<8;j++)
res[i][j]*=Q[i][j];
if(T==1)
{
for(int i=0;i<8;i++)
{
for(int j=0;j<8;j++)
cout<<res[i][j]<<' ';
cout<<endl;
}
return 0;
}
if(T==2)
{
for(int i=0;i<8;i++)
for(int j=0;j<8;j++)
for(int u=0;u<8;u++)
for(int v=0;v<8;v++)
{
double a,b;
if(u==0) a=sqrt(1/2.0);
else a=1.0;
if(v==0) b=sqrt(1/2.0);
else b=1.0;
d[i][j]+=0.25*a*b*res[u][v]*cos(acos(-1)/8.0*(i+1/2.0)*u)*cos(acos(-1)/8.0*(j+1/2.0)*v);
}
for(int i=0;i<8;i++)
{
for(int j=0;j<8;j++)
{
res[i][j]=(int)(d[i][j]+128.5);
res[i][j]=res[i][j]>255?255:res[i][j];
res[i][j]=res[i][j]<0?0:res[i][j];
}
}
for(int i=0;i<8;i++)
{
for(int j=0;j<8;j++)
cout<<res[i][j]<<' ';
cout<<endl;
}
}
return 0;
}
2022-9防疫大数据
2022-6角色授权
20%
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int n,m,q;
int main()
{
cin>>n>>m>>q;
if(n==1&&m==1)
{
string name;
int nv;
string s_nv;
int no;
string s_no;
int nn;
cin>>name>>nv>>s_nv>>no>>s_no>>nn;
string role;
int ns;
string n1;
string g_name;
cin>>role>>ns>>n1>>g_name;
while(q--)
{
string na,ng,gn,s1,s2,s3;
cin>>na>>ng>>gn>>s1>>s2>>s3;
if(n1=="u")
{
if(na==g_name) puts("1");
else puts("0");
}
if(n1=="g")
{
if(gn==g_name) puts("1");
else puts("0");
}
}
}
}
2022-3计算资源调度器
20%
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int n,m,g;
int f,a,na,pa,paa,paar;
int main()
{
cin>>n>>m;
int temp;
for(int i=0;i<n;i++) cin>>temp;
cin>>g;
int id=1;
for(int i=0;i<g;i++)
{
cin>>f>>a>>na>>pa>>paa>>paar;
for(int i=0;i<f;i++)
{
cout<<id<<' ';
id++;
if(id>n) id=1;
}
cout<<endl;
}
}
2021-12登机牌条码
10%
#include<iostream>
#include<cstring>
#include<algorithm>
#define x first
#define y second
using namespace std;
int w,s;
int q[70];
const int N=2000;
int pre[N],a[N],b[N];
string str;
void build_q()
{
q['A']=q['a']=q['0']=0;
q['B']=q['b']=q['1']=1;
q['C']=q['c']=q['2']=2;
q['D']=q['d']=q['3']=3;
q['E']=q['e']=q['4']=4;
q['F']=q['f']=q['5']=5;
q['G']=q['g']=q['6']=6;
q['H']=q['h']=q['7']=7;
q['I']=q['i']=q['8']=8;
q['J']=q['j']=q['9']=9;
q['K']=q['k']=10;
q['L']=q['l']=11;
q['M']=q['m']=12;
q['N']=q['n']=13;
q['O']=q['o']=14;
q['P']=q['p']=15;
q['Q']=q['q']=16;
q['R']=q['r']=17;
q['S']=q['s']=18;
q['T']=q['t']=19;
q['U']=q['u']=20;
q['V']=q['v']=21;
q['W']=q['w']=22;
q['X']=q['x']=23;
q['Y']=q['y']=24;
q['Z']=q['z']=25;
}
void build_pre()
{
for(int i=0;i<str.size();i++)
{
if(str[i]>='A'&&str[i]<='Z') pre[i]=0;
if(str[i]>='a'&&str[i]<='z') pre[i]=1;
if(str[i]>='0'&&str[i]<='9') pre[i]=2;
}
}
int get_num(int x)
{
if(pre[x-1]==0&&pre[x]==1) return 27;
if(pre[x-1]==0&&pre[x]==2) return 28;
if(pre[x-1]==1&&pre[x]==2) return 28;
if(pre[x-1]==2&&pre[x]==1) return 27;
if(pre[x-1]==2&&pre[x]==0) return 28;
return 0;
}
int main()
{
//初始化q[]
build_q();
cin>>w>>s;
cin>>str;
build_pre();
a[0]=q[str[0]];
int j=1;
for(int i=1;i<str.size();i++)
{
if(get_num(i)!=0)
a[j++]=get_num(i);
a[j++]=q[str[i]];
}
if(j%2==1) a[j]=29;
int k=1;
for(int i=0;i<j;i+=2)
{
b[k++]=30*a[i]+a[i+1];
}
int t=0;
if(k%w!=0)
{
t=w-k%w;
}
while(t--)
{
b[k++]=900;
}
b[0]=k;
for(int i=0;i<k;i++)
cout<<b[i]<<endl;
}
2021-9脉冲神经网络
scanf读入
100%
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int n,s,p,T;
double dt;
const int N=2010,INF=1e8;
int R[N];
int h[N],ne[N],D[N],e[N],idx;
double v[N],u[N],a[N],b[N],c[N],d[N],w[N];
int r[N],cnt[N];
double I[1024][N/2];//强度
static unsigned long _next = 1;
/* RAND_MAX assumed to be 32767 */
int myrand(void) {
_next = _next * 1103515245 + 12345;
return((unsigned)(_next/65536) % 32768);
}
void add(int a,int b,double c,int d)
{
e[idx]=b,w[idx]=c,D[idx]=d,ne[idx]=h[a],h[a]=idx++;
}
int main()
{
//cin>>n>>s>>p>>T;
scanf("%d%d%d%d",&n,&s,&p,&T);
scanf("%lf",&dt);
// cin>>dt;
memset(h,-1,sizeof h);
for(int i=0;i<n;)
{
int rn;
cin>>rn;
double vv,uu,aa,bb,cc,dd;
scanf("%lf%lf%lf%lf%lf%lf",&vv,&uu,&aa,&bb,&cc,&dd);
// cin>>vv>>uu>>aa>>bb>>cc>>dd;
for(int j=0;j<rn;j++,i++)
v[i]=vv,u[i]=uu,a[i]=aa,b[i]=bb,c[i]=cc,d[i]=dd;
}
for(int i=n;i<n+p;i++)
scanf("%d",&r[i]);
// cin>>r[i];
int mod=0; //跨度
while(s--)
{
int a,b,d;
double c;
scanf("%d%d%lf%d",&a,&b,&c,&d);
// cin>>a>>b>>c>>d;
add(a,b,c,d); //出,入,脉冲强度,传播延迟
mod=max(mod,d+1);
}
for(int i=0;i<T;i++)
{
int t=i%mod;
for(int j=n;j<n+p;j++)
if(r[j]>myrand())
{
for(int k=h[j];~k;k=ne[k])
{
int x=e[k];
I[(t+D[k])%mod][x]+=w[k];//在t+D[K]这个时刻第x个神经元发射信号
}
}
for(int j=0;j<n;j++) //神经元
{
double vv= v[j],uu=u[j];
v[j]=vv+dt*(0.04*vv*vv+5*vv+140-uu)+I[t][j];
u[j]=uu+dt*a[j]*(b[j]*vv-uu);
if(v[j]>=30)
{
for(int k=h[j];~k;k=ne[k])
{
int x=e[k];
I[(t+D[k])%mod][x]+=w[k];//在t+D[K]这个时刻第x个神经元发射信号
}
cnt[j]++;
v[j]=c[j],u[j]+=d[j];
}
}
memset(I[t],0,sizeof I[t]); //清空 因为环形数组
}
double minv=INF,maxv=-INF;
int minc=INF,maxc=-INF;
for(int i=0;i<n;i++)
{
minv=min(minv,v[i]);
maxv=max(maxv,v[i]);
minc=min(minc,cnt[i]);
maxc=max(maxc,cnt[i]);
}
printf("%.3lf %.3lf\n",minv,maxv);
cout<<minc<<' '<<maxc<<endl;
}
2021-4DHCP服务器
100
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=1e4+10;
int n,m,t_def,t_max,t_min;
string h;
struct IP{
int state;//0:未分配,1:待分配,2;占用,3:过期
int t;//过期时间
string owner;
}ip[N];
void update_ips_state(int tc)
{
for(int i=1;i<=n;i++)
if(ip[i].t&&ip[i].t<=tc)
{
if(ip[i].state==1)
{
ip[i].state=0;
ip[i].owner="";
ip[i].t=0;
}
else{
ip[i].state=3;
ip[i].t=0;
}
}
}
int get_ip_by_owner(string client)
{
for(int i=1;i<=n;i++)
if(ip[i].owner==client)
return i;
return 0;
}
int get_ip_by_state(int state)
{
for(int i=1;i<=n;i++)
if(ip[i].state==state)
return i;
return 0;
}
int main()
{
cin>>n>>t_def>>t_max>>t_min>>h;
cin>>m;
while(m--)
{
int tc;
string client,server,type;
int id,te;
cin>>tc>>client>>server>>type>>id>>te;
if(server!=h&&server!="*")
{
if(type!="REQ") continue;
}
if(type!="DIS"&&type!="REQ") continue;
if(server=="*"&&type!="DIS"||server==h&&type=="DIS") continue;
update_ips_state(tc);
if(type=="DIS")
{
int k=get_ip_by_owner(client);
if(!k) k=get_ip_by_state(0);
if(!k) k=get_ip_by_state(3);
if(!k) continue;
ip[k].state=1,ip[k].owner=client;
if(!te) ip[k].t=tc+t_def;
else
{
int t=te-tc;
t=max(t,t_min),t=min(t,t_max);
ip[k].t=tc+t;
}
cout<<h<<' '<<client<<' '<<"OFR"<<' '<<k<<' '<<ip[k].t<<endl;
}
else
{
if(server!=h)
{
for(int i=1;i<=n;i++)
if(ip[i].owner==client&&ip[i].state==1)
{
ip[i].state=0;
ip[i].owner="";
ip[i].t=0;
}
continue;
}
if(!(id>=1&&id<=n&&ip[id].owner==client))
cout<<h<<' '<<client<<' '<< "NAK"<<' '<<id<<' '<<'0'<<endl;
else
{
ip[id].state=2;
if(!te) ip[id].t=tc+t_def;
else
{
int t=te-tc;
t=max(t,t_min),t=min(t,t_max);
ip[id].t=tc+t;
}
cout<<h<<' '<<client<<' '<<"ACK"<<' '<<id<<' '<<ip[id].t<<endl;
}
}
}
}
2020-12带配额的文件系统
2020-9点亮数字人生
2020-6Markdown渲染器
0%
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int check(string str) //空格也占
{
int cnt=0;
int k=0;
while(str[k]==' ') k++; //去首部空格
int u=str.size()-1;
while(str[u]==' ') u--; //去尾部空格
return u-k+1;
}
int main()
{
int n,res=0;
cin>>n;
getchar();
string str;
while(getline(cin,str))
{
int cnt=check(str);
// cout<<cnt<<endl;
if(cnt==0) continue;
if(cnt%n==0)
res=res+cnt/n+1;
else
res=res+cnt/n+2;
// cout<<res<<endl;
}
cout<<res-1;
}
10%
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
bool check(string str) //空格也占
{
for(int i=0;i<str.size();i++)
{
if(str[i]!=' ') return false;
}
return true;
}
int main()
{
int n,res=0;
cin>>n;
getchar();
string str;
while(getline(cin,str))
{
if(!check(str)) res++;
}
res=res*2+1;
cout<<res;
}
2019-12化学方程式
30%
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=130;
int cntl[N],cntr[N]; //65
int T;
int main()
{
cin>>T;
while(T--)
{
memset(cntl,0,sizeof cntl);
memset(cntr,0,sizeof cntr);
string s;
cin>>s;
bool flag=1;
for(int i=0;i<s.size();i++)
{
if(s[i]=='=')
{
flag=0;continue;
}
if(s[i]=='+') continue;
if(flag) cntl[s[i]]++;
else cntr[s[i]]++;
}
bool success=1;
for(int i=0;i<130;i++)
if(cntl[i]!=cntr[i])
{
success=0;
break;
}
if(success) puts("Y");
else puts("N");
}
}
100%
#include<iostream>
#include<algorithm>
#include<cstring>
#include<unordered_map>//哈希表
#define x first
#define y second
using namespace std;
typedef unordered_map<string,int>MPSI;
MPSI dfs(string& str,int &u)
{
MPSI res;
while(u<str.size())
{
if(str[u]=='(')
{
u++; //过滤掉左括号
auto t=dfs(str,u);
u++; //过滤右括号
int cnt=1,k=u;
while(k<str.size()&&isdigit(str[k])) k++;
if(k>u)
{
cnt=stoi(str.substr(u,k-u));
u=k;
}
for(auto c:t)
res[c.x]+=c.y*cnt;
}
else if(str[u]==')') break; //返回上一层
else
{
int k=u+1;
while(k<str.size()&&str[k]>='a'&&str[k]<='z') k++;
auto key=str.substr(u,k-u);
u=k;
int cnt=1;
while(k<str.size()&&isdigit(str[k])) k++;
if(k>u)
{
cnt=stoi(str.substr(u,k-u));
u=k;
}
res[key]+=cnt;
}
}
return res;
}
MPSI work(string str)
{
MPSI res;
for(int i=0;i<str.size();i++)
{
int j=i+1;
while(str[j]!='+'&&j<str.size()) j++;
auto item=str.substr(i,j-i);
i=j;//跳到加号之后的位置
int cnt=1,k=0;
while(k<item.size()&&isdigit(item[k])) k++;
if(k>0) cnt=stoi(item.substr(0,k)); //有数字
auto t=dfs(item,k);
for(auto c:t)
res[c.x]+=c.y*cnt;
}
return res;
}
int main()
{
int n;
cin>>n;
while(n--)
{
string str;
cin>>str;
int k=str.find('=');
auto left=work(str.substr(0,k)),right=work(str.substr(k+1));
if(left==right) puts("Y");
else puts("N");
}
}
2019-9字符画
2019-3损坏的RAID5
2018-12CIDR合并
2018-9元素选择器
2018-3URL映射
2017-12Crontab
2017-9Json查询
2017-3Markdown
100%
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
using namespace std;
vector<string>strs;
int work_link(string str,int i)
{
string text,link;
for(i++;str[i]!=']';i++)
{
char c=str[i];
if(c=='_')
{
text+="<em>";
i++;
while(str[i]!='_') text+=str[i++];
text+="</em>";
}
else text+=c;
}
for(i+=2;str[i]!=')';i++)
link+=str[i];
printf("<a href=\"%s\">%s</a>",link.c_str(),text.c_str());
return i;
}
int work_em(string str,int i)
{
printf("<em>");
for(i++;str[i]!='_';i++) //过滤掉下划线
{
char c=str[i];
if(c=='[') i=work_link(str,i);
else cout<<c;
}
printf("</em>");
return i;
}
void work_line(string str)
{
int k=0;
while(str[k]==' ') k++;
str=str.substr(k);
for(int i=0;i<str.size();i++)
{
char c=str[i];
if(c=='_') i=work_em(str,i);
else if(c=='[') i=work_link(str,i);
else cout<<c;
}
}
void work(int a,int b)
{
if(strs[a][0]=='#') //段落
{
int k=0;
while(strs[a][k]=='#') k++;
printf("<h%d>",k);
work_line(strs[a].substr(k));
printf("</h%d>\n",k);
}
else if(strs[a][0]=='*')
{
printf("<ul>\n");
for(int i=a;i<=b;i++)
{
printf("<li>");
work_line(strs[i].substr(1));
printf("</li>\n");
}
printf("</ul>\n");
}
else
{
printf("<p>");
for(int i=a;i<=b;i++)
{
work_line(strs[i]);
if(i!=b) cout<<endl;
}
printf("</p>\n");
}
}
int main()
{
string str;
while(getline(cin,str)) strs.push_back(str);
for(int i=0;i<strs.size();i++)
{
if(strs[i].empty()) continue;
int j=i+1;
while(j<strs.size() &&strs[j].size()) j++;
work(i,j-1); //处理段落
i=j-1;
}
}