提交时间:2021-05-23 08:46:58
运行 ID: 163
#include <iostream> using namespace std; int a[100]; int main() { int n; cin >> n; for(int i = 1; i <= n; i++) { cin >> a[i]; } for(int i = n; i >= 1; i--) { if(a[i] % 3 == 0) { cout << a[i] << " "; } } cout << endl; for(int i = n; i >= 1; i--) { if(i % 3 == 0) { cout << a[i] << " "; } } return 0; }