版本比较
3/27 蒋
正文
增加 23 行删除 23 行
13 行未改动1415161718191819202122232425252627282913 行未改动434445464747484950515252535455565758555657585960616263646465666667686970717273747575767777787980818282838485858687888917 行未改动1071081091101111111121131141151161161171181191201211221221231241251261271281281291301311321311321331341351361371361371381391401418 行未改动13 行未改动
int main(){ cin >> n; for(int i = n; i >= 1; i--)
for(int i = n; i >= 1; i--) { dq.push_front(i); dq.push_front(dq.back()); dq.pop_back(); }
while(dq.size() > 0) { cout << dq.front() << " "; dq.pop_front();13 行未改动
using namespace std;
int n, a[105];queue<int> q, q2; queue<int> q, q2;
int main(){ cin >> n;
for(int i = 1; i <= n; i++) { cin >> a[i]; q.push(a[i]); } cin >> a[i]; q.push(a[i]); }
int maxi = -1e9; for(int i = 1; i <= n; i++) { q.push(q.front()); q.pop();
q2 = q;
int cnt = 1, ans = 0; while(cnt <= n && q2.empty() == 0) { if(cnt == q2.front()) { cnt = 1; ans += q2.front(); q2.pop(); continue; continue; }
q2.push(q2.front()); q2.pop(); cnt++; }
maxi = max(maxi, ans); }
cout << maxi; return 0;}```17 行未改动
signed main(){ cin >> n >> p;
for(int i = 1; i <= n; i++) { cin >> a[i]; }
int sum = 0; for(int i = 1; i <= n; i++) { sum += a[i]; pq.push(-a[i]);
while(sum + pq.top() >= p) { sum -= -pq.top(); pq.pop(); }
if(sum >= p) { cout << pq.size() << " "; } cout << pq.size() << " "; } else { cout << -1 << " "; } } } } return 0;}```# U504636 拖板车8 行未改动