We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
not able to minimize the running time. plz help....
include
include
include
include
include
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
long long int L,R,i,sum=0;
int sum1,sum2,n,x,k,j,t;
int a[18];
cin>>L>>R>>k;
for(i=L;i<=R;i++)
{
j=i;
n=0;
while(j!=0)
{
a[n]=j%10;
j=j/10;
n++;
}
if(n<=k)
{
sum=(sum+i)%1000000007;
continue;
}
sum1=0,sum2=0;
for(t=0;t
k-balance number
You are viewing a single comment's thread. Return to all comments →
not able to minimize the running time. plz help....
include
include
include
include
include
using namespace std;
int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */
long long int L,R,i,sum=0; int sum1,sum2,n,x,k,j,t; int a[18];
cin>>L>>R>>k; for(i=L;i<=R;i++) { j=i; n=0; while(j!=0) { a[n]=j%10; j=j/10; n++; } if(n<=k) { sum=(sum+i)%1000000007;
continue; } sum1=0,sum2=0; for(t=0;t
}