杭电1008总是WA?The highest building in our city has only one elevator.A request list is made up with N positive numbers.The numbers denote at which floors the elevator will stop,in specified order.It costs 6 seconds to move the elevator up one fl

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/07 00:06:02
杭电1008总是WA?The highest building in our city has only one elevator.A request list is made up with N positive numbers.The numbers denote at which floors the elevator will stop,in specified order.It costs 6 seconds to move the elevator up one fl

杭电1008总是WA?The highest building in our city has only one elevator.A request list is made up with N positive numbers.The numbers denote at which floors the elevator will stop,in specified order.It costs 6 seconds to move the elevator up one fl
杭电1008总是WA?
The highest building in our city has only one elevator.A request list is made up with N positive numbers.The numbers denote at which floors the elevator will stop,in specified order.It costs 6 seconds to move the elevator up one floor,and 4 seconds to move down one floor.The elevator will stay for 5 seconds at each stop.
For a given request list,you are to compute the total time spent to fulfill the requests on the list.The elevator is on the 0th floor at the beginning and does not have to return to the ground floor when the requests are fulfilled.
Input
There are multiple test cases.Each case contains a positive integer N,followed by N positive numbers.All the numbers in the input are less than 100.A test case with N = 0 denotes the end of input.This test case is not to be processed.
Output
Print the total time on a single line for each test case.
Sample Input
1 2
3 2 3 1
0
Sample Output
17
41
我的代码在dev c++里面通过的,我感觉没有错啊!
#include
using namespace std;
int main()
{
int n,prev,sum,i;
while(cin>>n && =0)
{
prev=0;
sum=0;
int *a = new int[n];
for(i=0;i>a[i];
for(i=0;iprev)
sum+=(a[i]-prev)*6+5;
else if(a[i]

杭电1008总是WA?The highest building in our city has only one elevator.A request list is made up with N positive numbers.The numbers denote at which floors the elevator will stop,in specified order.It costs 6 seconds to move the elevator up one fl
楼主是不是交错题或者选错编译器了?
我用你的代码交,过了(交C++和G++都过了)

杭电1008总是WA?The highest building in our city has only one elevator.A request list is made up with N positive numbers.The numbers denote at which floors the elevator will stop,in specified order.It costs 6 seconds to move the elevator up one fl 杭电acm2504 为什么WA有三个正整数a,b,c(0 杭电1008,我的代码总是WA,求救.本人初学.小鸟.#include using namespace std;void main(){int n,k,i,a,sum;while(cin>>n&&n!=0){k=0;for(i=1;i>a;if(k==0){sum=a*6+5;k=a;}if(a>k){sum+=6*(a-k)+5;k=a;}if(a We heard that the current price on your side is much highe than what you said.这句话正确吗? Watashi Wa的《The Game》 歌词 一道杭电ACM的测试题,我运行的没问题,但是提交却是WA,Problem DescriptionJack and Jill have decided to sell some of their Compact Discs,while they still have some value.They have decided to sell one of each of the CD titles that they 定语从句which前逗号Continued sedimentation - the process ofdeposit's setting on the sea bottom - buries the organic matter and subjects itto higher temperature and pressures,which convert the organic matter to oiland gas.这里which指代highe The price of a cup of coffee is highe than ____ of a glass of cola.A it B price C that D one要解析,为什么要选那一个,并且请把不选其他三个的原因告诉我 A contract to cover all maintenance and repairs to heating,electrical,and plumbing facilities ...A contract to cover all maintenance and repairs to heating,electrical,and plumbing facilities removes the risk that unexpected breakdown will cause highe 杭电1008水题,怎么会wa了?顺便菜鸟师傅.#include #include using namespace std;int main(int argc,char *argv[]){int n,s,p,m,i;while(cin>>n&&n!=0){p=0,s=0;for(i=0;i>m;if(pm){s+=(p-m)*4+5;p=m;}}cout I'm Great Wa to going the连词成句 杭电ACM3637 求算法看起来是水题~但我写了2天的结果就是过了样例 提交WA 我是直接暴力递增分母 但目测一定不行! 杭电2504题为什么WA?又见GCDTime Limit:1000/1000 MS (Java/Others) Memory Limit:32768/32768 K (Java/Others)Total Submission(s):4020 Accepted Submission(s):1632Problem Description有三个正整数a,b,c(0 电加热蒸汽发生器为什么总是报警 为什么我总是被静电电到? 最近为啥总是被 静电 电? 为什么我总是被静电电到? 手机总是很快没电 怎么办?