#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e5 + 10;
int x[N] , a[N] , b[N] , c[N] , n;
char op;
bool cmp(int a[],int b[]) {
for(int i = n;i >= 1;i--) {
if(a[i] != b[i]) return a[i] > b[i];
}
return 1;
}
void add(int a[],int b[]) {
int t = 0;
for(int i = 1;i <= n;i++) {
t += a[i] + b[i];
c[i] = t % x[i];
t /= x[i];
}
}
void sub(int a[],int b[]) {
if(cmp(a,b) == 0) {
sub(b,a);
return;
}
int t = 0;
for(int i = 1;i <= n;i++) {
t += a[i] - b[i];
c[i] = (t + x[i]) % x[i];
if(t < 0) t = -1;
else t = 0;
}
}
int main( ) {
scanf("%d",&n);
for(int i = n;i >= 1;i--) scanf("%d",&x[i]);
for(int i = n;i >= 1;i--) scanf("%d",&a[i]);
cin >> op;
for(int i = n;i >= 1;i--) scanf("%d",&b[i]);
if(op == '+') add(a,b);
else sub(a,b);
for(int i = n;i >= 2;i--) printf("%d ",c[i]);
printf("%d",c[1]);
return 0;
}
实在是找不到错在哪了,求大佬帮忙看看。