#include<iostream>usingnamespace std;intmain(){int N, m, tmp, T =0, D =0, E =0, t, e =0, e0 =0, flag;//N苹果树总数,m每棵树的记录次数//T苹果总数,D掉苹果的树总数,E连续3棵掉苹果的组数//t每棵树的苹果树,e记录连续掉苹果的棵树,e0记录前两棵//flag该树是否掉了苹果的标志
cin >> N;for(int i =1; i <= N; i++){
cin >> m >>t;
flag =0;for(int j =1; j < m; j++){
cin >> tmp;if(tmp >0)if(tmp < t){
t = tmp;if(flag ==0)
flag =1;}else
t += tmp;}if(flag){
D++;
e++;if(i ==1|| i ==2)
e0++;if(e ==3){
E++;
e--;}}else
e =0;
T += t;}if(e0 + e >=3)//圈的头尾连接判断是否有连续三棵树掉了苹果
E += e0 + e -2;
cout << T <<' '<< D <<' '<< E << endl;return0;}
CCF201909-2 小明种苹果(续)题目样例附C++代码解决#include<iostream>using namespace std;int main() { int N, m, tmp, T = 0, D = 0, E = 0, t, e = 0, e0 = 0, flag; //N苹果树总数,m每棵树的记录次数 //T苹果总数,D掉苹果的树总数,E...