BUGCAL - Editorial

There is a comment button but it will be available when you have at least 50 karma. Also thanks for pointing out, I’ll correct the typo :slight_smile:

@meooow But I can still make my answer as comment. Then what difference will it make when I get 50 points?

And what about the solution links not working?

If you really can convert your answer to a comment that’s a bug, not a feature :stuck_out_tongue:
About the solution links, it’s not under my control but I am letting the admins know.

Let me check by posting an answer if that option really works.

It really works…!!

Haha, well good then. Also the solution links are working now.

Thank you. And BTW Should I report this bug to codechef? Are you sure users with less than 50 Karma points can’t comment?

@meooow I have mailed to bugs@codechef.com about this. Lets see what they have to say about it and What is the outcome.

Its a known issue. Dont worry. BTW, you shouldnt actually do that if you want to be away for trouble. Word is, that one of the mods is reallllllyyyy strict.

@vijju123 I wasn’t exploiting the bug. I just came to know about it and I tested it only once for surety. I reported it immediately when I was sure about it. I am sorry if I offended someone or made someone angry, but I meant no harm.

In your first loop, you can’t be sure that i applies to a[] andj applies to b[].

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t–)
{
string s,s1;
cin>>s>>s1;
int x=s.length()-1,y=s1.length()-1;
vector v;
while(x>=0&&y>=0)
{
int tem=s[x]-‘0’;
int tem1=s1[y]-‘0’;
tem+=tem1;
if(tem>9)
v.push_back(tem%10);
else
v.push_back(tem);

        x--;
        y--;
    }
    while(x>=0)
    {
        v.push_back(s[x]-'0');
        x--;
    }
    while(y>=0)
    {
        v.push_back(s1[y]-'0');
        y--;
    }
    for(int i=v.size()-1;i>=0;i--)
    cout<<v[i];
    cout<<endl;
    
    
}

}
can anyone please help me 2nd task is not passed … please check once

vector v; it is declared correctly :grin: but not printed there please once check any mistake is there

please see what’s wrong with my code for subtask 2.

https://www.codechef.com/viewsolution/30034312

why my code is partially correct (subtask1 is correct but not subtask2)
here is my code -

#include
using namespace std;

int main(void) {
int t;
cin>>t;
while(t–){
int a,b,sum;
cin>>a>>b;
if((a%10+b%10) >= 10){
sum = a+b-10;
}
else{
sum = a+b;
}
cout<<sum<<endl;
}
return 0;
}

Here is my approach

https://www.codechef.com/viewsolution/30914245

https://www.codechef.com/viewsolution/33142823
my test cases and constraint one is working but subtask 2 isn’t pls help
Also when i removed my sum array and instead used res=res+sum*pow(10,i);
it works …WHY?
https://www.codechef.com/viewsolution/33142823
this is the one which works .I dont understand what difference does the array make to print WA

can i know what is wrong in this code

cook your dish here

t=int(input())
while t>0:
a,b=map(int,input().split())
l1=[]
l2=[]
l3=[]
while a>0:
l1.append(a%10)
a=int(a/10)
while b>0:
l2.append(b%10)
b=int(b/10)
while len(l1)<len(l2):
l1.append(0)
while len(l2)<len(l1):
l2.append(0)
for i in range(len(l1)):
x=(l1[i]+l2[i])%10
l3.append(x)
l3.reverse()
for i in l3:
print(i,end="")
print()
t-=1

Step- Coders I am stuck !!! help me
https://www.codechef.com/viewsolution/42220470

giving partial marks …
Thanks in advance…

couldn’t pass subtask 2

#include<string>
using namespace std;

int main() {
int a,b,t,x,y;
    cin>>t;
    while(t--)
    {
    	cin>>a>>b;
    	string a_str= to_string(a);
 		string b_str= to_string(b);

 		int sa = a_str.length();
 		int sb = b_str.length();

 		int aa[sa],bb[sb];

 		for(int i = 0 ; i<sa ; ++i)
 		{
 			aa[i] = a % 10;
 			a/=10;
 		}
 			for(int i = 0 ; i<sb ; ++i)
 		{
 			bb[i] = b % 10;
 			b/=10;
 		}

 		 x = (sb<=sa) ? sb : sa ;
 		y = (sb>=sa) ? sb : sa ;  

 		int sum[y];

 		for(int i = 0 ; i<x ; ++i)
 		{
 			if( (aa[i]+bb[i]) > 9) sum[i] = ( aa[i] + bb[i]) - 10 ;
 			else sum[i] = aa[i] + bb[i] ;

 		} 

 		if ( x != y) {

 		for(int i = x ; i<y ; ++i)
 		{
 			sum[i] = (sa>sb) ? aa[i] : bb[i] ;
 		}
}

 		for(int i = y-1 ; i>=0 ; --i) cout<<sum[i];
 			cout<<endl;
    }
    	return 0;
}```