HELP:Getting WA in SWPDGT, working for all testcases i tried

#include
#include
#include
#include
#include
using namespace std;
int main()
{

int t;
cin >> t;
while (t--)
{
	int a, b;
	cin >> a >> b;

	if (a % 10 == 0 && b % 10 == 0)
		cout << a + b << "\n";
	else if (a < 10 && b < 10)

		cout << a + b << "\n";


	else if (a < 10 || b < 10)
	{
		if (a < 10 && a>(b / 10))
		{
			int multi = a;
			int num = 0;
			num = b % 10;
			a = b / 10;
			b = multi * 10 + num;
		}
		else if (b<10 && b>(a / 10))
		{
			int num = 0;
			int multi = b;
			num = a % 10;
			b = a / 10;
			a = b * 10 + num;
		}


		//cout << a << " " << b << endl;
		cout << a + b << "\n";
	}

	else if (a / 10 == b / 10)
	{
		// cout<<"work"<<"\n";
		if (a < b)
		{
			int la = 0, fa = 0, lb = 0, fb = 0;

			la = a % 10;
			fa = a / 10;
			lb = b % 10;
			fb = b / 10;

			a = lb * 10 + la;
			b = fb * 10 + fa;
			//   cout<<a<<" "<<b<<"\n";
			cout << a + b << "\n";
		}
		else if (b =< a)
		{
			int la = 0, fa = 0, lb = 0, fb = 0;

			la = a % 10;
			fa = a / 10;
			lb = b % 10;
			fb = b / 10;

			b = la * 10 + lb;
			a = fa * 10 + fb;
			// cout<<a<<" "<<b<<"\n";
			cout << a + b << "\n";
		}
		else
		{
			// cout<<a<<" "<<b<<"\n";
			cout << a + b << "\n";
		}

	}
	else
	{
		int la = 0, fa = 0, lb = 0, fb = 0;

		la = a % 10;
		fa = a / 10;
		lb = b % 10;
		fb = b / 10;


		if (fa < lb)
			swap(fa, lb);
		else if (fb < la)
			swap(fb, la);
		int ansa = fa * 10 + la;
		int ansb = fb * 10 + lb;

		cout << ansa + ansb << "\n";

	}




}

}

Can you please fix the indentation? Or please send a pastebin/hastebin link

3 Likes

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

This is the list of all testcases where your solution fails:

3 Likes

Here’s the code with which I found all the WA testcases:

It runs the program for all possible A and B, and then compares it with your solution and an AC solution.

3 Likes

Thanks again,i modified my code and got AC.

1 Like