Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // LTTS - tìm x max sao cho n! % 2^x == 0, input n
- #include <iostream>
- using namespace std;
- int n;
- void main()
- {
- cin>>n;
- int sodu=0;
- int dem=0;
- for(int i=2; i<=n; i+=2)
- {
- int tam =i;
- while(tam > 0 && tam % 2 == 0)
- {
- sodu=tam%2;
- tam=tam/2;
- if(sodu==0)
- dem++;
- }
- }
- cout<<dem<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement