usingnamespacestd; intmain() { intn; ifstreamfin("d:\\OJ\\uva_in.txt"); streambuf*old=cin.rdbuf(fin.rdbuf()); while (cin>>n) { cout<<n+ (int)ceil(log2(n)) -2<<endl; } cin.rdbuf(old); return0; }
usingnamespacestd; intmain() { intn; ifstreamfin("d:\\OJ\\uva_in.txt"); streambuf*old=cin.rdbuf(fin.rdbuf()); while (cin>>n) { cout<<n+ (int)ceil(log2(n)) -2<<endl; } cin.rdbuf(old); return0; }