Submission

Status:

--xxxx-x--

Subtask/Task Score:

0/100

Score: 0

User: hmmm

Problemset: ทางเชื่อม

Language: cpp

Time: 0.045 second

Submitted On: 2026-02-28 21:47:15

#include<bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(0), cin.tie(0);

    int n;
    cin >> n;

    const int mod = 1e9+7;

    while(n--){
        int l;
        cin >> l;

        string top, down;
        cin >> top >> down;

        long long dpT = 1, dpD = 1;
        for(int i = 0; i < l; i++){
            bool T = (top[i] == '.');
            bool D = (down[i] == '.');
            bool TD = (T && D);

            long long nT = 0, nD = 0;
            if(TD){
                nT = (dpT + dpD);
                nD = (dpT + dpD);
            }
            else if(T){
                nT = dpT;
            }
            else if(D){
                nD = dpD;
            }

            dpT = nT;
            dpD = nD;
        }

        cout << (dpT + dpD) % mod << "\n";
    }

    return 0;
}