Link:

ARC061 传送门

C:

暴力$dfs$就好了

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
ll n,res=0;
int dgt[15],cnt;

void dfs(int dep,ll sum)
{
    if(dep==cnt){res+=sum;return;}
    for(int i=dep+1;i<=cnt;i++)
    {
        ll t=0;
        for(int j=dep+1;j<=i;j++) 
            t=t*10+dgt[j];
        dfs(i,sum+t);
    }
}

int main()
{
    scanf("%lld",&n);
    for(;n;n/=10) dgt[++cnt]=n%10;
    reverse(dgt+1,dgt+cnt+1);dfs(0,0);
    printf("%lld",res);
    return 0;
}
Problem C

相关文章:

  • 2021-12-23
  • 2022-02-07
  • 2021-09-17
  • 2022-02-07
  • 2021-06-24
  • 2021-05-19
  • 2022-01-02
  • 2021-12-03
猜你喜欢
  • 2022-12-23
  • 2022-02-10
  • 2021-12-14
  • 2022-01-18
  • 2021-09-23
  • 2021-07-13
  • 2022-12-23
相关资源
相似解决方案