其他分享
首页 > 其他分享> > CSP1640373 - 小明种苹果(续)

CSP1640373 - 小明种苹果(续)

作者:互联网



 1 #include <iostream>
 2 using namespace std;
 3 typedef long long ll;
 4 bool special[4]{false};
 5 int main()
 6 {
 7     ios::sync_with_stdio(false);
 8     cin.tie(0);
 9 
10     // 1 2 n-1 n
11     int n;
12     cin >> n;
13     ll T = 0, D = 0, E = 0;
14     int cont_drop = 0;
15     for (int i = 1; i <= n; i++) {
16         int m;
17         cin >> m;
18         ll nowT = 0;
19         bool isDropped = false;
20         for (int j = 1; j <= m; j++) {
21             int x;
22             cin >> x;
23             if (x > 0) {
24                 if (nowT > x)
25                     isDropped = true;
26                 nowT = x;
27             }
28             else nowT += x;
29         }
30         T += nowT;
31         if (isDropped) {
32             D++;
33             cont_drop++;
34             if (cont_drop >= 3)
35                 E++;
36             if (i == 1)
37                 special[0] = true;
38             if (i == 2)
39                 special[1] = true;
40             if (i == n - 1)
41                 special[2] = true;
42             if (i == n)
43                 special[3] = true;
44         }
45         else
46             cont_drop = 0;
47     }
48     if (special[0] && special[2] && special[3])
49         E++;
50     if (special[0] && special[1] && special[3])
51         E++;
52 
53 //    for (int i = 0; i < 4; i++)
54 //        cout << special[i] << endl;
55     cout << T << ' ' << D << ' ' << E << endl;
56 
57     return 0;
58 }

 

标签:cont,小明种,int,++,CSP1640373,苹果,nowT,true,special
来源: https://www.cnblogs.com/AntonLiu/p/11972862.html