Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main(){
- int n=0;
- int x=0;
- int y=0;
- int suma[10000]={0};
- int tab[10000]={0};
- int tab2[10000]={0};
- cin >> n;
- for (int i=0;i<n;i++){
- cin >> x;
- for(int j=(x-1);j>=0;j--){
- cin >> tab[j];
- }
- cin >> y;
- for(int k=(y-1);k>=0;k--){
- cin >> tab2[k];
- }
- if(x>y){
- for(int m=0;m<x;m++){
- suma[m] += tab[m]+tab2[m];
- if(suma[m]>=2){
- suma[m] -= 2;
- suma[m+1] += 1;
- cout << suma[m] << " ";
- }
- }
- }
- else{
- for(int m=0;m<y;m++){
- suma[m] += tab[m]+tab2[m];
- if(suma[m]>=2){
- suma[m] -= 2;
- suma[m+1] += 1;
- cout << suma[m] << " ";
- }
- }
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement