第四题后半部分: for (int i = 0; i < n; ++i) { int t; cin >> t; sum += t; v.push_back(sum); } int po = 1; bool f = true; int r = 0; while (po<v.size()&;&;f) { for (int i = po; i < v.size(); ++i) { if (ma <= v[i]) { ma = v[i]; po = i; } } for (int i = r; i < po&;&;i<v.size(); ++i) { if (v[po] - v[i] >= sum &;&; !(i == 0 &;&; po == v.size() - 1)) { f = false; cout << "Yes" << '\n'; break; } } r = po; ++po; } if (f) { cout << "No" << '\n'; } } return 0; }
点赞 评论

相关推荐

无情咸鱼王的秋招日记之薛定谔的Offer:好拒信,偷了,希望有机会用到
点赞 评论 收藏
分享
牛客网
牛客企业服务