Advertisement
thienlang

test

Mar 19th, 2014
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. void main()
  4. {
  5.     int n = 9, m = 6;
  6.  
  7.     int Du = 1;
  8.     int Thuong = 1;
  9.     int k = 0;
  10.     for ( int i = 1; i <= n; i++)
  11.     {
  12.         Thuong = Du * i /m;
  13.         Du = (Du * i ) % m;
  14.  
  15.         if ( Du == 0)
  16.         {
  17.             k++;
  18.             Du = Thuong;
  19.         }
  20.  
  21.     }
  22.     std::cout << k;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement