*主要注意的点是:要特判以n-1、n、1是否连续掉落(以n为中间);以及n、1、2是否连续掉落(以n为开头) 1 #include <stdio.h> 2 #define MAX 1005 3 4 using namespace std; 5 6 struct Node{ 7 int apple; 8 bool flag; 9 }; 10 11 12 int main(){ 13 Node tree[MAX]; 14 int n,m,x; 15 int sum,count,three; 16 while(scanf("%d",&n)!=EOF){ 17 sum=count=three=0; 18 for(int i=1;i<=n;i++){ 19 tree[i].flag=false; 20 tree[i].apple=0; 21 } 22 for(int i=1;i<=n;i++){ 23 scanf("%d",&m); 24 for(int j=1;j<=m;j++){ 25 scanf("%d",&x); 26 if(j>1 && x>0 && x<=tree[i].apple){ 27 //count++; 28 if(x<tree[i].apple) tree[i].flag=true; 29 tree[i].apple=x; 30 } 31 else tree[i]