天天看點

Codeforces Round #742 (Div. 2) C. Carrying Conundrum

​​傳送門​​

Codeforces Round #742 (Div. 2) C. Carrying Conundrum

題意:

思路:

#include<bits/stdc++.h>
#include<ctime>
using namespace std;
#define ll long long 
ll a[100];
ll sum[110];
ll res[110];

int main()
{
  int t;
  cin>>t;
  while(t--)
  {
    memset(sum, 0, sizeof(sum));
    ll n;
    cin>>n;
    ll ans = 1;
    int cnt = 0;
    while(n)
    {
      a[++cnt] = n%10;
      n/=10;
    }
    int flag = 0;
    for(int i = 1; i <= cnt/2; i++)
    {
      int op = a[i];
      a[i] = a[cnt-i+1];
      a[cnt-i+1] = op;
    }
    ll now = 0;
    for(int i = 1; i <= cnt; i += 2)
    {
      now = now*10+a[i];
    }
    ans = now+1;
    now = 0;
    for(int i = 2; i <= cnt; i += 2)
    {
      now = now*10+a[i];
    }
    ll ans2 = now+1;
    cout<<ans*ans2 - 2<<endl;
  }
}      

繼續閱讀