正文
增加 5 行删除 5 行
25 行未改动262728293031323334353637383940414225 行未改动}for(int i = 1; i <= n; i++){cin >> t[i];}ans += x[n]; //先去到最后一户人家for(int i = n; i >= 0; i--){if(i <= n - 1){ans += x[i + 1] - x[i]; //去到下一户人家的时间}int tc = t[i] - ans; //还有多少分钟才放退货物品if(tc <= 0){tc = 0; //已经放在门口了}ans += tc; //加上等待时间}cout << ans << endl;```25 行未改动262728293031323334353637383940414225 行未改动}for(int i = 1; i <= n; i++){cin >> t[i];}ans += x[n]; //先去到最后一户人家for(int i = n; i >= 0; i--){if(i <= n - 1){ans += x[i + 1] - x[i]; //去到下一户人家的时间}int tc = t[i] - ans; //还有多少分钟才放退货物品if(tc <= 0){tc = 0; //已经放在门口了}ans += tc; //加上等待时间}cout << ans << endl;```