hey my 2 test cases are running but two are not running out of 4 … i think my code is right and i also unlock the test cases but unable to open the test cases . whenever i open the test case my pc shows that this file does not open as you dont have particular app to open this file…so first of all tell me how to open you test case whenever we unlock and download …and then tell me what is error in my code as 2 test cases are not running
here is my code
#include
using namespace std;
int sum(int a[1000000],int b[1000000],int n,int m)
{
int i,j,k,q,w;
int c[1000000];
if(n>m)
{
k=n-m;
for(i=m-1+k;i>=k;i–)
{
b[i]=b[i-k];
}
for(i=0;i<k;i++)
{
b[i]=0;
}
m+=k;
}
if(m>n)
{
k=m-n;
for(i=n-1+k;i>=k;i–)
{
a[i]=a[i-k];
}
for(i=0;i<k;i++)
{
a[i]=0;
}
n+=k;
}
if(m==n)
{
w=0;
for(i=n-1;i>=0;i–)
{
if(i==0)
{
q=a[i]+b[i];
c[i]=q+w;
}
else
{
q=(a[i]+b[i])%10;
c[i]=q+w;
}
w=(a[i]+b[i])/10;
}
for(i=0;i<n;i++)
{
cout<<c[i]<<", ";
}
}
cout<<"END";
return 0;
}
int main() {
int i,j,s,n,m;
int a[1000000],b[1000000];
cin>>n;
for(i=0;i<n;i++)
{
cin>>a[i];
}
cin>>m;
for(i=0;i<m;i++)
{
cin>>b[i];
}
sum(a,b,n,m);
return 0;
}