The Preliminary Contest for ICPC Asia Shanghai 2019 L. Digit sum
Posted c4lnn
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了The Preliminary Contest for ICPC Asia Shanghai 2019 L. Digit sum相关的知识,希望对你有一定的参考价值。
题目:https://nanti.jisuanke.com/t/41422
思路:预处理
#include<bits/stdc++.h> using namespace std; int dp[11][1000001]={0}; int main() { for(int i=2;i<=10;i++) { for(int j=1;j<=1000000;j++) { int t=j; int res=0; res=j%i; dp[i][j]=res+dp[i][j/i]+dp[i][j-1]; } } int T; scanf("%d",&T); int n,b; for(int i=1;i<=T;i++) { scanf("%d%d",&n,&b); printf("Case #%d: %d ",i,dp[b][n]); } return 0; }
以上是关于The Preliminary Contest for ICPC Asia Shanghai 2019 L. Digit sum的主要内容,如果未能解决你的问题,请参考以下文章
The Preliminary Contest for ICPC Asia Yinchuan 2019
The Preliminary Contest for ICPC Asia Shenyang 2019
The Preliminary Contest for ICPC Asia Shanghai 2019
The Preliminary Contest for ICPC Asia Shanghai 2019