PROBLEM LINK:
Practice
Author: Dharmendra Bhai Patel
Tester: Abhijeet Trigunait
Editorialist:Dharmendra Bhai Patel
DIFFICULTY:
CAKEWALK, SIMPLE, EASY.
PREREQUISITES:
Basic maths, Simple calculations.
PROBLEM:
There are x routes for visiting place B from the initial position , y routes for visiting place C from place B and z route for visiting place D from place C. so you have to find the maximum possible routes for visiting place D from the initial position.
EXPLANATION:
The multiplication principle is applied when we want to calculate the number of possible ways to perform a task(perform all the subtasks).The task consists of 𝑘 subtasks(𝑛1,𝑛2,𝑛3,…,𝑛𝑘), the subtasks can be done in 𝑚1,𝑚2,𝑚3,…,𝑚𝑘 ways respectively.Thus the number of possible ways to do the task is 𝑚1×𝑚2×𝑚3×…×𝑚𝑘.
Given m1 number of ways to reach from A to B and m2 ways to reach B to C and so on …
so finally the solution stands like 𝑚1×𝑚2×𝑚3×…×𝑚𝑘
SOLUTIONS:
Setter's Solution
#include<bits/stdc++.h>
using namespace std;
int main()
{
int tc;
cin>>tc;
while (tc--)
{ int x,y,z;
cin>>x>>y>>z;
cout<<x*y*z<<"\n";
} return 0;
}