题意: 给定一个数,要求找出两个数经过一个修改后的加法操作得到这个数的方案数。修改后的加法操作是进位操作修改为进位到左边第二位
思路:注意到,题目除掉了a==0||b==0的情况,这种状态实际上可以通过特判答案减2来实现,根据题目修改后的加法操作的性质,将数划分为奇数和偶数位,两者互不影响。将两边分别按位构建a,b两个数,答案即为a+1,b+1相乘减去2
#include<iostream>
#include<cstring>
#include<cstdio>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<bitset>
#include<cmath>
#include<array>
#include<atomic>
#include<sstream>
#include<stack>
#include<iomanip>
//#include<bits/stdc++.h>
//#define int ll
#define IOS std::ios::sync_with_stdio(false);std::cin.tie(0);
#define pb push_back
#define endl '\n'
#define x first
#define y second
#define Endl endl
#define pre(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,b,a) for(int i=b;i>=a;i--)
#define si(x) scanf("%d", &x);
#define sl(x) scanf("%lld", &x);
#define ss(x) scanf("%s", x);
#define YES {puts("YES");return;}
#define NO {puts("NO"); return;}
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef pair<int, PII> PIII;
typedef pair<char, int> PCI;
typedef pair<int, char> PIC;
typedef pair<double, double> PDD;
typedef pair<ll, ll> PLL;
const int N = 200010, M = 2 * N, B = N, MOD = 2e18;
const double eps = 1e-7;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
int dx[4] = { -1,0,1,0 }, dy[4] = { 0,1,0,-1 };
//int dx[8] = { 1,2,2,1,-1,-2,-2,-1 }, dy[8] = { 2,1,-1,-2,-2,-1,1,2 };
int n, m, k;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll lowbit(ll x) { return x & -x; }
ll qmi(ll a, ll b, ll MOD) {
ll res = 1;
while (b) {
if (b & 1) res = res * a % MOD;
a = a * a % MOD;
b >>= 1;
}
return res;
}
inline void init() {}
inline void slove()
{
string s;
cin >> s;
int a = 0, b = 0;
int flag = 0;
for(int i=0;i<s.size();i++)
{
int v = s[i] - '0';
if (++flag & 1) {
a *= 10;
a += v;
}
else {
b *= 10;
b += v;
}
}
cout << (a + 1) * (b + 1) - 2 << endl;
}
signed main()
{
//IOS;
int _ = 1;
si(_);
init();
while (_--)
{
slove();
}
return 0;
}
/*
1
6 6
5 5 5 5 5 5
*/