| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
WA了一次才AC 贴个代码……在线算法……
写得略难看
#include<cstdio>
using namespace std;
int main()
{
int n;
scanf("%d",&n);
bool boom = true;
int last = -1;
for(int i=0;i<n;i++)
{
int x;
scanf("%d",&x);
if(boom)
{
if(x>=last) boom = false;
}
else
{
if(x<=last)
{
if(x<last) boom = true;
printf("%d\n",i);
}
}
if(i == n-1)
{
if(!boom) printf("%d\n",i+1);
}
last = x;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator