杭电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
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/16 04:38:10
杭电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
杭电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
杭电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
//
#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 < n; i++)
{
cin >> m;
if(p < m)
{
s += (m - p) * 6 + 5;
p = m;
}
//if(p > m) //还有一种情况就是:还在考虑到哪一层,在原地暂停 5S
else //所以改用else 即可
{
s += (p - m) * 4 + 5;
p = m;
}
}
cout