Problem 1Problem code: CMB01 |
Reversed number is a number written in arabic numerals but the order of digits is reversed. The first digit becomes last and vice versa. For example, if the number is 1245,it will become 5421 .Note that all the leading zeros are omitted. That means if the number ends with a zero, the zero is lost by reversing (e.g. 1200 gives 21). Also note that the reversed number never has any trailing zeros. Your task is to add two reversed numbers and output their reversed sum. Of course, the result is not unique because any particular number is a reversed form of several numbers (e.g. 21 could be 12, 120 or 1200 before reversing). Thus we must assume that no zeros were lost by reversing (e.g. assume that the original number was 12).
Input
The input consists of N cases (equal to about 10000). The first line of the input contains only positive integer N. Then follow the cases. Each case consists of exactly one line with two positive integers separated by space. These are the reversed numbers you are to add.
Output
For each case, print exactly one line containing only one integer - the reversed sum of two reversed numbers. Omit any leading zeros in the output.
Example
Input: 1 24 1 Output: 34
| Author: | vishesh_sigma |
| Date Added: | 28-01-2010 |
| Time Limit: | 50 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC |
Comments

Fetching successful submissions

where can i register for this
where can i register for this contest ????????????
or without registering i can submit solution??????????
#include<stdio.h> void
#include<stdio.h>
void main()
{
int n, f[50],s[50],r[50],x,y,i,a,b,c,sum1=0,sum2=0,su=0;
printf("n Enter the number of trial cases");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("n Enter the first value");
scanf("%d",&x);
printf("n Enter the second value");
scanf("%d",&y);
f[i]=x;
s[i]=y;
while(x!=0)
{
a=x%10;
sum1=(sum1*10)+a;
x=x/10;
}
while(y!=0)
{
b=y%10;
sum2=(sum2*10)+b;
y=y/10;
}
sum=sum1+sum2;
while(sum!=0)
{
c=sum%10;
su=(su*10)+c;
sum=sum/10;
}
r[i]=su;
printf("n The resultant reversed sum is = %d",r[i]);
}
}
#include<stdio.h>#include<con
#include<stdio.h>
#include<conio.h>
void main()
{
int no, f[50],s[50],r[50],x,y,i,a,b,c,sum1=0,sum2=0,su=0;
printf("n Enter the number of numbers to sum");
scanf("%d",&no);
for(i=0;i<no;i++)
{
printf("n Enter the first value");
scanf("%d",&x);
printf("n Enter the second value");
scanf("%d",&y);
f[i]=x;
s[i]=y;
while(x!=0)
{
a=x%10;
sum1=(sum1*10)+a;
x=x/10;
}
while(y!=0)
{
b=y%10;
sum2=(sum2*10)+b;
y=y/10;
}
sum=sum1+sum2;
while(sum!=0)
{
c=sum%10;
su=(su*10)+c;
sum=sum/10;
}
r[i]=su;
printf("n The reversed sum is = %d",r[i]);
}
}
who is sitting inside the cpu
who is sitting inside the cpu and reading all those printf messages ? . . Remove them all, just take scanf inputs and just print the final result of each test case in a new line.