#include <iostream> #include <cmath> #include <queue> using namespace std; int main() { int number_of_stone = 0; int number_of_bomb = 0; cin>>number_of_stone>>number_of_bomb; priority_queue<double> q; double weight; for(int i=0;i<number_of_stone;i++){ cin>>weight; q.push(weight); } for(int i=0;i<number_of_bomb;++i){ double a = q.top(); q.pop(); a /=2.0; if(a>=1.0){ q.push(a); q.push(a); } } cout<<(int)ceil(q.top()); return 0; }
最後的(int)沒加會錯 但在codeblocks上運行結果都一樣