题解 | #最后k个元素#
最后k个元素
https://www.nowcoder.com/practice/9e497c068b8a4f53b0f0576f89ff4ebe
#include<bits/stdc++.h> using namespace std; int main(){ int n,k; vector<int>a; // write your code here...... cin>>n>>k; a.resize(n); for(int i=0;i<n;i++) { cin>>a[i]; } for(int i=n-1;i>n-k-1;i--) { cout<<a[i]<<" "; } return 0; }