标签:nan asi shanghai its ant pre The 预处理 icp
题目: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\n",i,dp[b][n]); } return 0; }
The Preliminary Contest for ICPC Asia Shanghai 2019 L. Digit sum
标签:nan asi shanghai its ant pre The 预处理 icp
原文地址:https://www.cnblogs.com/c4Lnn/p/12090728.html