15,666,925 members
1.00/5 (1 vote)
See more:
There are non-negative integers A, B, C, D, E, and F, which satisfy A×B×C≥D×E×F.
Find the remainder when (A×B×C)−(D×E×F)(A×B×C)is divided by 998244353.
Constraints

0≤A,B,C,D,E,F≤10^18
A×B×C≥D×E×F
A, B, C, D, E, and F are integers.

What I have tried:

#include<stdio.h>
int main()
{
long long int a,b,c,d,e,f,dif=0,rem=0;
scanf("%lld%lld%lld%lld%lld%lld",&a,&b,&c,&d,&e,&f);

dif=(a*b*c)-(d*e*f);
rem=dif%998244353;
printf("%lld\n",rem);
return 0;
}
Posted
Updated 28-Nov-22 11:17am
v3

Solution 2

Unless you are using an arbitrary-precision arithmetic library, you know you cannot actually multiply such big numbers (for example, a 64-bit unsigned can hold numbers up to, roughly 1019).
Luckily enough, you don't have to actually multiply them, see, for instance Modular Multiplication - GeeksforGeeks[^].

merano99 28-Nov-22 17:59pm
+5
CPallini 29-Nov-22 1:50am
Thank you.

Solution 1

While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

But so far, you haven't even read the question properly: where does it ask you to input any values, much less all of them? You have been given a final result - it's up to you to use your maths skills and coding to work out the solution not to input a set of values and see if they are right.
Think about what the problem is trying to get you to do, and then about how you solve that manually. Work out a plan before you jump into code!

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]