标签:九度oj amp scan i++ code span printf bsp main
#include<cstdio> int buf[105]; int main(){ int n; int num; bool isfirst; scanf("%d",&n); while(n--){ scanf("%d",&num); isfirst=1; for(int i=0;i<num;i++) scanf("%d",&buf[i]); if(buf[0]>buf[1]||buf[0]<buf[1]){ printf("0"); isfirst=0; } for(int i=1;i<num-1;i++){ if((buf[i-1]<buf[i]&&buf[i]>buf[i+1])||(buf[i-1]>buf[i]&&buf[i]<buf[i+1])){ if(!isfirst) printf(" "); printf("%d",i); if(isfirst) isfirst=0; } } if(buf[num-1]>buf[num-2]||buf[num-1]<buf[num-2]){ if(!isfirst) printf(" "); printf("%d",num-1); } printf("\n"); } return 0; }
标签:九度oj amp scan i++ code span printf bsp main
原文地址:http://www.cnblogs.com/kprac/p/7076948.html