This is my solution to the competitive coding question on SPOJ here. It gives a runtime of 0.24 but the best solutions posted have a 0.0 runtime. How could I possibly achieve better results than this?
#include<iostream>
#include<cstdio>
using namespace std;
int rev(int num)
{
int rev_num=0;
while(num)
{
rev_num= rev_num*10 + num%10;
num/=10;
}
return rev_num;
}
int main()
{
int n, n1, n2;
scanf("%d",&n);
while(n--)
{
cin>>n1>>n2;
cout<<rev(rev(n1)+rev(n2))<<endl;
}
return 0;
}