Storing integers

Revision en2, by kirankumarmitra, 2018-07-20 21:32:43

Can someone suggest any good resources to learn about how various integer data types are manipulated in C++ from a competitive programming perspective ? I'm having problems with understanding them, for example

  • When you do something like long int x = y*z, where y and z are long long int, but the value of y and z are small (say 100), would it cause overflow ?

  • When you do something like int x = (a*b) % prime when a, b, prime are of the order 109 (but still stored in int), would it cause overflow ?

  • What is the difference between double/point/long double etc ? How they're manipulated (like the above) ?

  • Does using longer (for example, using long long int instead of int) causes the programme to run slower ? If yes, then how much (like a factor of 2 ? a factor of 4 ?)

  • Why almost nobody uses long double in competitive programming ?

  • When manipulating digits of HUGE orders (like 10500), how that's done in CP ?

  • Why the strange result in running the following code ?

code

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English kirankumarmitra 2018-07-20 21:32:43 22 formatting
en1 English kirankumarmitra 2018-07-20 21:31:19 1325 Initial revision (published)