早教吧作业答案频道 -->其他-->
zoj1259,例子过了,wa,程序有注释哦~Rails--------------------------------------------------------------------------------TimeLimit:1SecondMemoryLimit:32768KB-------------------------------------------------------------------------------
题目详情
zoj 1259,例子过了,wa,程序有注释哦~
Rails
--------------------------------------------------------------------------------
Time Limit:1 Second Memory Limit:32768 KB
--------------------------------------------------------------------------------
There is a famous railway station in PopPush City.Country there is incredibly hilly.The station was built in last century.Unfortunately,funds were extremely limited that time.It was possible to establish only a surface track.Moreover,it turned out that the station could be only a dead-end one (see picture) and due to lack of available space it could have only one track.
The local tradition is that every train arriving from the direction A continues in the direction B with coaches reorganized in some way.Assume that the train arriving from the direction A has N
Rails
--------------------------------------------------------------------------------
Time Limit:1 Second Memory Limit:32768 KB
--------------------------------------------------------------------------------
There is a famous railway station in PopPush City.Country there is incredibly hilly.The station was built in last century.Unfortunately,funds were extremely limited that time.It was possible to establish only a surface track.Moreover,it turned out that the station could be only a dead-end one (see picture) and due to lack of available space it could have only one track.
The local tradition is that every train arriving from the direction A continues in the direction B with coaches reorganized in some way.Assume that the train arriving from the direction A has N
▼优质解答
答案和解析
#include
#include
#include
using namespace std;
int b[1100];//数组用来存输入的序列
int main()
{
stack a;//保存序列的栈
stack xb;//序列中元素对应的下标的栈
int n,i,p,x;
while(scanf("%d",&n)!=EOF&&n)//序列的个数
{
while(scanf("%d",&b[0])!=EOF&&b[0])//序列的第一个数不为0就继续
{
while(!a.empty())//把栈清空
{
a.pop();
}
while(!xb.empty())//把栈清空
{
xb.pop();
}
p=1;//用来判断序列是否能变成1 2 3 ···n,假设能,p=1,不能,p=0
for(i=1;i=0;i--)//从序列的后面往前来
{
while(!a.empty()&&b[i]
#include
#include
using namespace std;
int b[1100];//数组用来存输入的序列
int main()
{
stack a;//保存序列的栈
stack xb;//序列中元素对应的下标的栈
int n,i,p,x;
while(scanf("%d",&n)!=EOF&&n)//序列的个数
{
while(scanf("%d",&b[0])!=EOF&&b[0])//序列的第一个数不为0就继续
{
while(!a.empty())//把栈清空
{
a.pop();
}
while(!xb.empty())//把栈清空
{
xb.pop();
}
p=1;//用来判断序列是否能变成1 2 3 ···n,假设能,p=1,不能,p=0
for(i=1;i=0;i--)//从序列的后面往前来
{
while(!a.empty()&&b[i]
看了zoj1259,例子过了,wa...的网友还看了以下:
圆柱的高一定,底面周长与体积成什么比例?我写的不成比例,有的人和我写的一样,有的写正比例大哥大姐们 2020-05-13 …
解比例时分辨正反比例有一些解比例的题目很难分出要用正比例解还是反比例解,要怎样才能快速的分辨出要用 2020-05-14 …
正方形的边长与面积()A.成正比例B.成反比例C.不成比例D.有时成正比例有时成反比例 2020-06-06 …
求『近朱者赤』的反例也就是『近朱者未必赤』!的例子!有没有比较有名的事例啊,多且好的事例有好评! 2020-06-24 …
率与比例有什么区别流行病的一些测量指标,比例有两类,一类是构成比例;另一类是发生频率比例.其中的发 2020-07-07 …
治疗组30例中,显效24例,有效5例,无效1例,总有效率96.7%;对照组24例中,显效10例,有 2020-07-12 …
分割线段如何将线段分割?除了黄金比例有具体的方法,那有没有在其他的方面的方法?比如线段有不同的比例如 2020-11-01 …
甲药治疗34例,有效3例,乙药治疗18例,有效7例.问:两种药物的有效率是否相同?用甲乙两种药物治疗 2020-11-29 …
正比例与反比例有哪些简便点的学法呢正比例很反比例有些搞不明白,还请亲们多多传授一下,主要是判断比例这 2020-12-12 …
zoj1259,例子过了,wa,程序有注释哦~Rails---------------------- 2021-01-12 …