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 |
贴代码,这题主要是思路#include <stdio.h> #include <string.h> int main() { int n,i,p,hgt[50010]; scanf("%d",&n); memset(hgt,0,sizeof(hgt)); for(i=1;i<=n;i++) { scanf("%d",&hgt[i]); } p=1; while(p<=n) { while(hgt[p]<hgt[p+1]) p++; printf("%d\n",p); while(hgt[p]>hgt[p+1]) p++; if(hgt[p]==hgt[p+1]) p++; } } 程序有很多可以改的地方,不过A了就懒得改了 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator