Problem in printing A*B where A and B (1≤A, B ≤10^18)

I went through a simple problem given below:

Your Task is so simple given to integer number A , B output A * B

Input:

The first line contains number of test cases T (T ≤1000)

Two Integer A and B (1≤A, B ≤10^18)

Output:

For each case, Print a case No and A * B

Sample Input/Output:
2
5 3
Case 1: 15
7 3
Case 2: 21

Problem ID: http://www.lightoj.com/practice_contest_showproblem.php?contest_id=552&problem=B

I wrote the following code for it..but it is showing Wrong Answer.

Why I'm getting WA..would anybody explain please?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
    int t;
    long long a,b;

    scanf("%d",&t);

    for(int i=1; i<=t; i++)
    {
        scanf("%lld %lld",&a,&b);
        printf("Case %d: %lld\n",i,a*b);
    }

    return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
// http://ideone.com/GCzHmO
#include <iostream>
#include <limits>
#include <cmath>

long long upper_limit = std::pow(10, 18);

int main()
{
    std::cout << std::numeric_limits<long long>::max() << '\n';
    std::cout << upper_limit << '\n';
    std::cout << upper_limit * upper_limit << '\n';
}
Thanks for your comment..but what did you want to make me understand? I couldn't understand. Will explain it please?

I've written a code mixing up with your given code http://ideone.com/qtCcCS but it also gives WA.
Run the code. Read the result. Reason about what is happening.
You already started this same thread somewhere else. Anyway the solution is to use a big integer class. There is one found on that website you posted
http://www.lightoj.com/article_show.php?article=1004&language=english&type=pdf
Topic archived. No new replies allowed.