You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a=a%100; //why we are doing this is becuase the multipication might lead to overflow so we are here reducing their value according to contraints
b=b%100;
c=c%100;
d=d%100;
p=a*b*c*d;
//Now printing last two digits of p
if(p%100<=9) cout<<0; //you can also do this if(p%100<=9) cout<<"0"<<p; else cout<<p%100; Note : "0" is in string otherwise if taken in no c++/c will neglec it
cout<<p%100;
return 0;
}
LOGIC:
5854 X 5896 = 34515184
54 X 96 = 5184
Conclusion on taking a%100, the last two digits of product still remains the same
link - https://codeforces.com/group/MWSDmqGsZm/contest/219158/problem/Y