题目

题意

给出一张图,每条道路有限高,给出车子的起点,终点,最高高度,问在保证高度尽可能高的情况下的最短路,如果不存在输出 $ cannot \ reach \ destination $

跟前面 $ hdu5418 $ 一样的,题目挺基础的,但是在细节方面比较抠。要是最高度尽可能高,我们就可以想去枚举可能的高度去跑 $ spfa $ ,但我们可以发现这样效率太低了,那么我们为什么不二分答案呢?给出最高高度了,最低不就是 $ 0 $ 吗?二分答案再去跑 $ spfa $ 加上限制条件。 这题时限 $ 10s $ 枚举其实一样能过,也跑得挺快的。另外我还敲了敲 $ floyd $ 果不其然,数据范围太大,它挂了。dijkstra它我也敲挂了(答案错误)等改对了再说吧。

比较坑的点:每组答案之间输出换行,因为这个格式错误了好几次。

代码(按时间从小到大排序

dijkstra(堆优化)+二分

$ 187MS $

/*
dijkstra(堆优化)+二分
Judge Status:Accepted
Exe.Time:187MS
Exe.Memory:1752K
Code Len:2640 B
*/
#include<bits/stdc++.h>
using namespace std;
const int N=1010;
const int M=1000010;
const int INF=0x3f3f3f3f;
struct node{
int h;
int data;
}edge[M];
int head[N],ver[M],Next[M],ans,minf,n,m,tot,star,en,sum,addmin;
void add(int x,int y,int z,int hi){
ver[++tot]=y;edge[tot].data=z;edge[tot].h=hi;Next[tot]=head[x];head[x]=tot;
}
struct nod{
int data;
int num;
}minn[M];
int d[N];
bool book[N];
void shiftdownmin(int x){
int t,flag=0;
while(x*2<=addmin&&flag==0){
if(minn[x].data>minn[x*2].data)t=x*2;
else t=x;
if(x*2+1<=addmin){
if(minn[t].data>minn[x*2+1].data)t=x*2+1;
}
if(t!=x){
swap(minn[t],minn[x]);
x=t;
}else flag=1;
}
}
void shiftupmin(int x) {
int flag=0;
if(x==1) return;
while(x!=1&&flag==0){
if(minn[x].data<minn[x/2].data) swap(minn[x],minn[x/2]);
else flag=1;
x=x/2;
}
}
void dijkstra(int mi){
memset(book,0,sizeof(book));
memset(d,0x3f,sizeof(d));addmin=0;
d[star]=0;
minn[++addmin].data=0;
minn[addmin].num=star;
while(addmin){
int x=minn[1].num;
minn[1]=minn[addmin--];
shiftdownmin(1);
if(book[x]) continue;
book[x]=1;
for(int i=head[x];i;i=Next[i]){
int y=ver[i],z=edge[i].data;
if(d[y]>d[x]+z&&edge[i].h>=mi){
d[y]=d[x]+z;
minn[++addmin].num=y;
minn[addmin].data=d[y];
shiftupmin(addmin);
}
}
}
}
int main(){
while(scanf("%d %d",&n,&m)){
if((!n)&&(!m)) return 0;
if(sum) printf("\n");
memset(head,0,sizeof(head));tot=0;sum++;
int l=0,r=0;
for(int i=1;i<=m;++i){
int x,y,z,h;
scanf("%d %d %d %d",&x,&y,&h,&z);
if(h==-1) h=INF;
add(x,y,z,h);
add(y,x,z,h);
}scanf("%d %d %d",&star,&en,&r);
ans=0;minf=0;
while(l<=r){
int mid=(l+r)>>1;
dijkstra(mid);
if(d[en]!=INF){
if(mid>ans){
ans=mid;
minf=d[en];
} l=mid+1;
}else r=mid-1;
}
printf("Case %d:\n",sum);
if(ans!=0){
printf("maximum height = %d\n",ans);
printf("length of shortest route = %d\n",minf);
}else printf("cannot reach destination\n");
}
return 0;
}

spfa+二分

$ 218MS $

/*
spfa+二分
Judge Status:Accepted
Exe.Time:218MS
Exe.Memory:1740K
Code Len:1772 B
*/
#include<bits/stdc++.h>
using namespace std;
const int N=1010;
const int M=1000010;
const int INF=0x3f3f3f3f;
struct node{
int h;
int data;
}edge[M];
int head[N],ver[M],Next[M],d[N],v[N],ans,minn,n,m,tot,star,en,sum;
void add(int x,int y,int z,int hi){
ver[++tot]=y;edge[tot].data=z;edge[tot].h=hi;Next[tot]=head[x];head[x]=tot;
}
queue<int>q;
void spfa(int mi){
memset(d,0x3f,sizeof(d));
memset(v,0,sizeof(v));
d[star]=0;v[star]=1;
q.push(star);
while(q.size()){
int x=q.front();q.pop();
v[x]=0;
for(int i=head[x];i;i=Next[i]){
int y=ver[i],z=edge[i].data;
if((d[y]>d[x]+z)&&edge[i].h>=mi){
d[y]=d[x]+z;
if(!v[y]) q.push(y),v[y]=1;
}
}
}
}
int main(){
while(scanf("%d %d",&n,&m)){
if((!n)&&(!m)) return 0;
if(sum) printf("\n");
memset(head,0,sizeof(head));tot=0;sum++;
int l=0,r=0;
for(int i=1;i<=m;++i){
int x,y,z,h;
scanf("%d %d %d %d",&x,&y,&h,&z);
if(h==-1) h=INF;
add(x,y,z,h);
add(y,x,z,h);
}scanf("%d %d %d",&star,&en,&r);
ans=0;minn=0;
while(l<=r){
int mid=(l+r)>>1;
spfa(mid);
if(d[en]!=INF){
if(mid>ans){
ans=mid;
minn=d[en];
}
l=mid+1;
}else r=mid-1;
}
printf("Case %d:\n",sum);
if(ans!=0){
printf("maximum height = %d\n",ans);
printf("length of shortest route = %d\n",minn);
}else printf("cannot reach destination\n");
}
return 0;
}

枚举+spfa

$ 390MS $

/*
spfa+枚举
Judge Status:Accepted
Exe.Time:390MS
Exe.Memory:1768K
Code Len:1668 B
*/
#include<bits/stdc++.h>
using namespace std;
const int N=1010;
const int M=1000010;
const int INF=0x3f3f3f3f;
struct node{
int h;
int data;
}edge[M];
int head[N],ver[M],Next[M],d[N],v[N],ans,minn,n,m,tot,star,en,sum;
void add(int x,int y,int z,int hi){
ver[++tot]=y;edge[tot].data=z;edge[tot].h=hi;Next[tot]=head[x];head[x]=tot;
}
queue<int>q;
void spfa(int mi){
memset(d,0x3f,sizeof(d));
memset(v,0,sizeof(v));
d[star]=0;v[star]=1;
q.push(star);
while(q.size()){
int x=q.front();q.pop();
v[x]=0;
for(int i=head[x];i;i=Next[i]){
int y=ver[i],z=edge[i].data;
if((d[y]>d[x]+z)&&edge[i].h>=mi){
d[y]=d[x]+z;
if(!v[y]) q.push(y),v[y]=1;
}
}
}
}
int main(){
while(scanf("%d %d",&n,&m)){
if((!n)&&(!m)) return 0;
if(sum) printf("\n");
memset(head,0,sizeof(head));tot=0;sum++;
int l=0,r=0;
for(int i=1;i<=m;++i){
int x,y,z,h;
scanf("%d %d %d %d",&x,&y,&h,&z);
if(h==-1) h=INF;
add(x,y,z,h);
add(y,x,z,h);
}scanf("%d %d %d",&star,&en,&r);
ans=0;minn=0;
for(int i=r;i;--i){
spfa(i);
if(d[en]!=INF){
ans=i;
minn=d[en];
break;
}
}
printf("Case %d:\n",sum);
if(ans!=0){
printf("maximum height = %d\n",ans);
printf("length of shortest route = %d\n",minn);
}else printf("cannot reach destination\n");
}
return 0;
}

dijkstra(堆优化)+枚举

$ 405MS $

/*
dijkstra(堆优化)+枚举
Judge Status:Accepted
Exe.Time:405MS
Exe.Memory:1752K
Code Len:2558 B
*/
#include<bits/stdc++.h>
using namespace std;
const int N=1010;
const int M=1000010;
const int INF=0x3f3f3f3f;
struct node{
int h;
int data;
}edge[M];
int head[N],ver[M],Next[M],ans,minf,n,m,tot,star,en,sum,addmin;
void add(int x,int y,int z,int hi){
ver[++tot]=y;edge[tot].data=z;edge[tot].h=hi;Next[tot]=head[x];head[x]=tot;
}
struct nod{
int data;
int num;
}minn[M];
int d[N];
bool book[N];
void shiftdownmin(int x){
int t,flag=0;
while(x*2<=addmin&&flag==0){
if(minn[x].data>minn[x*2].data)t=x*2;
else t=x;
if(x*2+1<=addmin){
if(minn[t].data>minn[x*2+1].data)t=x*2+1;
}
if(t!=x){
swap(minn[t],minn[x]);
x=t;
}else flag=1;
}
}
void shiftupmin(int x) {
int flag=0;
if(x==1) return;
while(x!=1&&flag==0){
if(minn[x].data<minn[x/2].data) swap(minn[x],minn[x/2]);
else flag=1;
x=x/2;
}
}
void dijkstra(int mi){
memset(book,0,sizeof(book));
memset(d,0x3f,sizeof(d));addmin=0;
d[star]=0;
minn[++addmin].data=0;
minn[addmin].num=star;
while(addmin){
int x=minn[1].num;
minn[1]=minn[addmin--];
shiftdownmin(1);
if(book[x]) continue;
book[x]=1;
for(int i=head[x];i;i=Next[i]){
int y=ver[i],z=edge[i].data;
if(d[y]>d[x]+z&&edge[i].h>=mi){
d[y]=d[x]+z;
minn[++addmin].num=y;
minn[addmin].data=d[y];
shiftupmin(addmin);
}
}
}
}
int main(){
while(scanf("%d %d",&n,&m)){
if((!n)&&(!m)) return 0;
if(sum) printf("\n");
memset(head,0,sizeof(head));tot=0;sum++;
int l=0,r=0;
for(int i=1;i<=m;++i){
int x,y,z,h;
scanf("%d %d %d %d",&x,&y,&h,&z);
if(h==-1) h=INF;
add(x,y,z,h);
add(y,x,z,h);
}scanf("%d %d %d",&star,&en,&r);
ans=0;minf=0;
for(int i=r;i;--i){
dijkstra(i);
if(d[en]!=INF){
ans=i;
minf=d[en];
break;
}
}
printf("Case %d:\n",sum);
if(ans!=0){
printf("maximum height = %d\n",ans);
printf("length of shortest route = %d\n",minf);
}else printf("cannot reach destination\n");
}
return 0;
}

dijkstra+二分

$ 1154MS $

/*
dijkstra+二分
Judge Status:Accepted
Exe.Time:1154MS
Exe.Memory:9376K
Code Len:2376 B
*/
#include<bits/stdc++.h>
using namespace std;
const int N=1010;
const int M=1000010;
const int INF=0x3f3f3f3f;
struct node{
int h;
int data;
}dis[N][N];
int ans,minn,n,m,tot,star,en,sum;
node d[N];
bool book[N];
void dijkstra(int x){
memset(book,0,sizeof(book));
memset(d,0x3f,sizeof(d));
for(int i=1;i<=n;++i){
if(dis[star][i].h>=x) d[i].data=dis[star][i].data;
d[i].h=dis[star][i].h;
}
d[star].data=0;book[star]=1;
for(int i=1;i<n;++i){
int minx=INF;
int op=-1;
for(int j=1;j<=n;++j){
if(d[j].data<minx&&book[j]!=1&&d[j].h>=x){
minx=d[j].data;
op=j;
}
}
if(op!=-1){
book[op]=1;
for(int j=1;j<=n;++j){
if(d[j].data>d[op].data+dis[op][j].data&&(!book[j])&&(dis[op][j].h>=x)&&(d[op].h>=x)){
d[j].data=d[op].data+dis[op][j].data;
d[j].h=min(d[op].h,dis[op][j].h);
}
}
}
}
}
int main(){
while(scanf("%d %d",&n,&m)){
if((!n)&&(!m)) return 0;
if(sum) printf("\n");
memset(dis,0,sizeof(dis));sum++;
for(int i=1;i<=n;++i){
for(int j=1;j<=n;++j){
if(i==j) dis[i][j].data=0;
else dis[i][j].data=INF;
}
}
int l=0,r=0;
for(int i=1;i<=m;++i){
int x,y,z,h;
scanf("%d %d %d %d",&x,&y,&h,&z);
if(h==-1) h=INF;
if(h>dis[x][y].h){
dis[x][y].data=z;
dis[x][y].h=h;
}
dis[y][x].data=dis[x][y].data;
dis[y][x].h=dis[x][y].h;
}scanf("%d %d %d",&star,&en,&r);
ans=0;minn=0;
while(l<=r){
int mid=(l+r)>>1;
dijkstra(mid);
if(d[en].data!=INF){
if(mid>ans){
ans=mid;
minn=d[en].data;
} l=mid+1;
}else r=mid-1;
}
printf("Case %d:\n",sum);
if(ans!=0){
printf("maximum height = %d\n",ans);
printf("length of shortest route = %d\n",minn);
}else printf("cannot reach destination\n");
}
return 0;
}

以下是非AC代码

/*
dijkstra+枚举
Judge Status:Time Limit Exceeded
Exe.Time:10000MS
Exe.Memory:9332K
Code Len:2287B
*/
#include<bits/stdc++.h>
using namespace std;
const int N=1010;
const int M=1000010;
const int INF=0x3f3f3f3f;
struct node{
int h;
int data;
}dis[N][N];
int ans,minn,n,m,tot,star,en,sum;
node d[N];
bool book[N];
void dijkstra(int x){
memset(book,0,sizeof(book));
memset(d,0x3f,sizeof(d));
for(int i=1;i<=n;++i){
if(dis[star][i].h>=x) d[i].data=dis[star][i].data;
d[i].h=dis[star][i].h;
}
d[star].data=0;book[star]=1;
for(int i=1;i<n;++i){
int minx=INF;
int op=-1;
for(int j=1;j<=n;++j){
if(d[j].data<minx&&book[j]!=1&&d[j].h>=x){
minx=d[j].data;
op=j;
}
}
if(op!=-1){
book[op]=1;
for(int j=1;j<=n;++j){
if(d[j].data>d[op].data+dis[op][j].data&&(!book[j])&&(dis[op][j].h>=x)&&(d[op].h>=x)){
d[j].data=d[op].data+dis[op][j].data;
d[j].h=min(d[op].h,dis[op][j].h);
}
}
}
}
}
int main(){
while(scanf("%d %d",&n,&m)){
if((!n)&&(!m)) return 0;
if(sum) printf("\n");
memset(dis,0,sizeof(dis));sum++;
for(int i=1;i<=n;++i){
for(int j=1;j<=n;++j){
if(i==j) dis[i][j].data=0;
else dis[i][j].data=INF;
}
}
int l=0,r=0;
for(int i=1;i<=m;++i){
int x,y,z,h;
scanf("%d %d %d %d",&x,&y,&h,&z);
if(h==-1) h=INF;
if(h>dis[x][y].h){
dis[x][y].data=z;
dis[x][y].h=h;
}
dis[y][x].data=dis[x][y].data;
dis[y][x].h=dis[x][y].h;
}scanf("%d %d %d",&star,&en,&r);
ans=0;minn=0;
for(int i=r;i;--i){
dijkstra(i);
if(d[en].data!=INF){
ans=i;
minn=d[en].data;
break;
}
}
printf("Case %d:\n",sum);
if(ans!=0){
printf("maximum height = %d\n",ans);
printf("length of shortest route = %d\n",minn);
}else printf("cannot reach destination\n");
}
return 0;
}
/*
floyd+枚举
Judge Status:Time Limit Exceeded
Exe.Time:10000MS
Exe.Memory:9740K
Code Len:1819 B
*/
#include<bits/stdc++.h>
using namespace std;
const int N=1010;
const int M=1000010;
const int INF=0x3f3f3f3f;
struct node{
int h;
int data;
}dis[N][N];
int ans,minn,n,m,tot,star,en,sum;
node d[N][N];
queue<int>q;
void floyd(int x){
memset(d,0x3f,sizeof(d));
for(int i=1;i<=n;++i){
for(int j=1;j<=n;++j){
if(dis[i][j].h>=x) d[i][j].data=dis[i][j].data;
d[i][j].h=dis[i][j].h;
}
}
for(int k=1;k<=n;++k){
for(int i=1;i<=n;++i){
for(int j=1;j<=n;++j){
if((d[i][j].data>d[i][k].data+d[k][j].data)&&(d[i][k].h>=x)&&(d[k][j].h>=x)){
d[i][j].data=d[i][k].data+d[k][j].data;
d[i][j].h=min(d[i][k].h,d[k][j].h);
}
}
}
}
}
int main(){
while(scanf("%d %d",&n,&m)){
if((!n)&&(!m)) return 0;
if(sum) printf("\n");
memset(dis,0,sizeof(dis));sum++;
for(int i=1;i<=n;++i){
for(int j=1;j<=n;++j){
if(i==j) dis[i][j].data=0;
else dis[i][j].data=INF;
}
}
int l=0,r=0;
for(int i=1;i<=m;++i){
int x,y,z,h;
scanf("%d %d %d %d",&x,&y,&h,&z);
if(h==-1) h=INF;
if(h>dis[x][y].h){
dis[x][y].data=z;
dis[x][y].h=h;
}
dis[y][x].data=dis[x][y].data;
dis[y][x].h=dis[x][y].h;
}scanf("%d %d %d",&star,&en,&r);
ans=0;minn=0;
for(int i=r;i;--i){
floyd(i);
if(d[star][en].data!=INF){
ans=i;
minn=d[star][en].data;
break;
}
}
printf("Case %d:\n",sum);
if(ans!=0){
printf("maximum height = %d\n",ans);
printf("length of shortest route = %d\n",minn);
}else printf("cannot reach destination\n");
}
return 0;
}
/*
/*
floyd+二分
Judge Status:Time Limit Exceeded
Exe.Time:10000MS
Exe.Memory:12212K
Code Len:1891 B
*/
#include<bits/stdc++.h>
using namespace std;
const int N=1010;
const int M=1000010;
const int INF=0x3f3f3f3f;
struct node{
int h;
int data;
}dis[N][N];
int ans,minn,n,m,tot,star,en,sum;
node d[N][N];
queue<int>q;
void floyd(int x){
memset(d,0x3f,sizeof(d));
for(int i=1;i<=n;++i){
for(int j=1;j<=n;++j){
if(dis[i][j].h>=x) d[i][j].data=dis[i][j].data;
d[i][j].h=dis[i][j].h;
}
}
for(int k=1;k<=n;++k){
for(int i=1;i<=n;++i){
for(int j=1;j<=n;++j){
if((d[i][j].data>d[i][k].data+d[k][j].data)&&(d[i][k].h>=x)&&(d[k][j].h>=x)){
d[i][j].data=d[i][k].data+d[k][j].data;
d[i][j].h=min(d[i][k].h,d[k][j].h);
}
}
}
}
}
int main(){
while(scanf("%d %d",&n,&m)){
if((!n)&&(!m)) return 0;
if(sum) printf("\n");
memset(dis,0,sizeof(dis));sum++;
for(int i=1;i<=n;++i){
for(int j=1;j<=n;++j){
if(i==j) dis[i][j].data=0;
else dis[i][j].data=INF;
}
}
int l=0,r=0;
for(int i=1;i<=m;++i){
int x,y,z,h;
scanf("%d %d %d %d",&x,&y,&h,&z);
if(h==-1) h=INF;
if(h>dis[x][y].h){
dis[x][y].data=z;
dis[x][y].h=h;
}
dis[y][x].data=dis[x][y].data;
dis[y][x].h=dis[x][y].h;
}scanf("%d %d %d",&star,&en,&r);
ans=0;minn=0;
while(l<=r){
int mid=(l+r)>>1;
floyd(mid);
if(d[star][en].data!=INF){
if(mid>ans){
ans=mid;
minn=d[star][en].data;
} l=mid+1;
}else r=mid-1;
}
printf("Case %d:\n",sum);
if(ans!=0){
printf("maximum height = %d\n",ans);
printf("length of shortest route = %d\n",minn);
}else printf("cannot reach destination\n");
}
return 0;
}

hdu 2962 题解的更多相关文章

  1. hdu 2962 Trucking (二分+最短路Spfa)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2962 Trucking Time Limit: 20000/10000 MS (Java/Others ...

  2. HDU 2962 Trucking

    题目大意:给定无向图,每一条路上都有限重,求能到达目的地的最大限重,同时算出其最短路. 题解:由于有限重,所以二分检索,将二分的值代入最短路中,不断保存和更新即可. #include <cstd ...

  3. HDU 2023题解分析

    我想说这道题我还没弄明白我错哪了,交了20多遍一直都是Runtime Error,改了N次还是不对,后来搜了一下,说是数组开小了,又把数组开大,还不对,又改发现一个平均值求错,再改,还不对,洗洗睡吧. ...

  4. 2014年北京网络赛 Instrusive HDU 5040 题解 优先队列

    网赛的时候看了这道题,发现就是平常的那种基础搜索题. 由于加了一个特殊条件:可以一次消耗3秒或原地停留1秒. 那就不能使用简单的队列了,需要使用优先队列才行. 题意 告诉一副地图:一个起点,一个终点, ...

  5. UVALive 4223 / HDU 2962 spfa + 二分

    Trucking Problem Description A certain local trucking company would like to transport some goods on ...

  6. hdu 5418 题解

    第一眼看到这题,哇,这不是我刚做完的题吗?大水题!然后 这题表面很水,实际上有点坑. 题意 求经过 $ 1 - n $(不能遗漏) 并且回到 $ 1 $ 的最短路. 在看这题之前我们可以来看下这题 最 ...

  7. HDU 1231 题解

    题面: 最大连续子序列 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Problem ...

  8. HDU - 5970 题解

    题目链接 HDU - 5970 分析 很显然\(f(x,y)\)与\(f(x+y*k,y)\)的结果相同,因为它们在第一次取模后会变成相同的式子 我们再看一下数据的范围,突破口肯定在\(m\)那里 那 ...

  9. 传递 HDU - 5961 题解

    题目传送门 分析 题目大意:给一个竞赛图,将图分成两部分,判断两部分的图是否符合传递闭包,a->b,b->c,则a->c 这道题用Floyd硬跑的显然n\({^3}\)会T 如果用b ...

随机推荐

  1. java的新生代 老年代 永久代

    介绍得非常详细: 新生代回收:(复制算法) 在堆中,新生代主要存放的是哪些很快就会被GC回收掉的或者不是特别大的对象(是否设置了-XX:PretenureSizeThreshold 参数).复制算法的 ...

  2. LeetCode 457. Circular Array Loop

    原题链接在这里:https://leetcode.com/problems/circular-array-loop/ 题目: You are given a circular array nums o ...

  3. LeetCode 930. Binary Subarrays With Sum

    原题链接在这里:https://leetcode.com/problems/binary-subarrays-with-sum/ 题目: In an array A of 0s and 1s, how ...

  4. Java如何正确的将数值转化为ArrayList?

    Java中使用工具类Arrays.asList()看似可以把一个数组转为List,但实际使用时有两个坑:1.它是泛型方法,传入的参数必须是对象数组,当传入一个原生数据类型数组时,Arrays.asLi ...

  5. linux命令之------More命令

    More命令 1)作用:命令类似cat,不过会以一页一页的形式显示,更方便使用者逐页阅读. 2)-num:一次显示的行数 3)-d:提示使用者,在画面下方显示[Press space to conti ...

  6. ubuntu之路——day12.1 不用tf和torch 只用python的numpy在较为底层的阶段实现简单神经网络

    首先感谢这位博主整理的Andrew Ng的deeplearning.ai的相关作业:https://blog.csdn.net/u013733326/article/details/79827273 ...

  7. (转载)golang 整数常量INT_MAX INT_MIN最大值最小值

    转载地址:https://blog.csdn.net/bdss58/article/details/78388858 在C语言中,有标准库limits.h定义了一些最大最小值常量,例如int类型的最大 ...

  8. 团队作业-Beta冲刺(1/4)

    队名:软工9组 组长博客:https://www.cnblogs.com/cmlei/ 作业博客:https://edu.cnblogs.com/campus/fzu/SoftwareEngineer ...

  9. 剑指offer:和为S的连续正数序列

    题目描述: 小明很喜欢数学,有一天他在做数学作业时,要求计算出9~16的和,他马上就写出了正确答案是100.但是他并不满足于此,他在想究竟有多少种连续的正数序列的和为100(至少包括两个数).没多久, ...

  10. SQLServer 截取函数 substring函数

    declare @name char(1000) --注意:char(10)为10位,要是位数小了会让数据出错 set @name='s{sss}fc{fggh}dghdf{cccs}x' selec ...