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
i need help. my code is running correctly. but when i try to print the sum of k-number, it gives wrong answer..
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
}
In challenges some problems marked like a unsolved, but actually it is solved, and exists accepted in submissions tab. For example, this problem :).