Guest User

Untitled

a guest
Jun 28th, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. double prob_regiao( int vendidas, int A, int y0, int y, double prob )
  2. {
  3.     double retorno;
  4.     int comeco_for, fim_for;
  5.    
  6.     if( y - y0 <= (2 * A)/2 )
  7.     {
  8.         comeco_for = y0;
  9.         fim_for = y;
  10.        
  11.         for( i = y0, retorno = 0.0; i <= y; i++ )
  12.         {
  13.             retorno += probY( vendidas, i, prob );
  14.         }
  15.     }
  16.     else if( y0 == 0 ) //entao com certeza ele pediu x - A > y, entao queremos x - A <= y, e portanto iremos querer 1 - P(y de y(inclusive) a x( inclusive))
  17.     {
  18.         for( i = vendidas - A, retorno = 1.0; i <= vendidas; i++ )
  19.         {
  20.             retorno -= probY( vendidas, i, prob );
  21.         }
  22.     }
  23.     else //entao com certeza ele pediu x - A <= y, entao queremos x - A > y, e portanto iremos querer 1 - P(y de 0 a x - A(não inclusive))
  24.     {
  25.         for( i = 0, retorno = 1.0; i < x - A; i++ )
  26.         {
  27.             retorno -= probY( vendidas, i, prob );
  28.         }
  29.     return retorno;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment