problem statement is here
#include<stdio.h>
#include<string.h>
#define mod 1000000007
int main(){
int c=1,i,n,t,u,v,s;
char ar[10011];
scanf("%d",&t);
while(t--){
s=0;
int br[11]={0};
scanf("%s",ar);
n=strlen(ar);
for(i=0;i<n;i++){
v=u=ar[i]-48;
while(v--){
br[u]=(br[u]+br[v])%mod;
}
br[u]++;
}
for(i=0;i<=9;i++){
s=(s+br[i])%mod;
}
printf("Case %d: %d\n",c,s);
c++;
}
return 0;
}
No comments:
Post a Comment