Mysterious Sum

Limits: 1s, 256 MB

Sohel vai reads newspaper every morning. The newspaper he reads contains some good features including different types of puzzle. He likes to those solve very much. In today’s newspaper the puzzle he found involves two numbers being added but with with a mysterious result. Below are a few examples:


This is a companion discussion topic for the original entry at https://toph.co/p/mysterious-sum
#include <iostream>
using namespace std;

int main() {
	unsigned int i,t,a,b,sum;
	cin>>t;
	for(i=1;i<=t;i++){
		cin>>a>>b;
		if(a<=100&&b<=100){
		sum=10*(a+b)+(a-b);
		cout<<"Case "<<i<<": "<<sum<<endl;
		}
	}
	return 0;
}

t=int(input())
for i in range(1,t+1):
a,b=[int(x) for x in input().split()]
sum=10*(a+b)+(a-b)
print(“Case {}: {}”.format(i,sum))
both says second test case wrong answer

It is because your solve is incorrect.
Read the problem statement carefully and try to figure out the mystry of the sum yourself.

#include<bits/stdc++.h>
using namespace std;
int main(){
    int t,a,b,c,d;
    cin>>t;
    for(int i=1;i<=t;i++){
        cin>>a>>b;
        c=a+b;
        d=a-b;
        cout<<"Case "<<i<<": "<<(c*10)+d<<endl;
    }
}

getting wrong in test case 2?

Your code will be

include<iostream>
#include<math.h>
using namespace std;
int main()
{
    int T,A,B,Sum=0,Sub=0;
    cin>>T;
    for(int i=1;i<=T;i++)
    {
        cin>>A>>B;
        Sum=A+B;
        Sub=A-B;
        cout<<"Case "<<i<<": "<<Sum<<Sub<<endl;
    }

}

Where is the problem in my code?
#include<stdio.h>
#inculde<math.h>
int main()
{
int T;
scanf("%d",&T);
for ( int i=1;i<=T;i++){
int N,M;
scanf("%d %d",&N,&M);
int Sum=N+M;
int Count =(Sum*10)+(N-M);
printf(“Case %d: %d”,i,Count);
}
return 0;
}