You are viewing a single comment's thread. Return to all comments →
Total number of combinations with atlest one bulb on = 2^n-1.
c++ code.
#include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; for(int i=0;i<t;i++) { int n,ans=1; cin>>n; for(int i=0;i<n;i++) { ans=ans*2; ans=ans%100000; } cout<<ans-1<<endl; } }
mod after each multiplication so that the variable don't go beyond it's range
Seems like cookies are disabled on this browser, please enable them to open this website
Diwali Lights
You are viewing a single comment's thread. Return to all comments →
Total number of combinations with atlest one bulb on = 2^n-1.
c++ code.
mod after each multiplication so that the variable don't go beyond it's range