#include <iostream> #include <cmath> using namespace std; int main() {long long n; long double x, b, suma=0; cin>>n; while(n--) {cin>>x; suma=suma+pow(2,x); } for(int i=1; pow(2,i)<=suma; i++) { b=i; } cout<<b; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #include <iostream> #include <cmath> using namespace std; int main() {long long n; long double x, b, suma=0; cin>>n; while(n--) {cin>>x; suma=suma+pow(2,x); } for(int i=1; pow(2,i)<=suma; i++) { b=i; } cout<<b; return 0; } |