Varianta 22 / Subiectul 3 / Problema 4 |
#include<fstream.h> ifstream f("bac.txt"); int a,b,n; int p2(int n) { int p=1; while (p<=n) p=p*2; return p/2; } void main() { f>>n; for(int i=1;i<=n;i++) { f>>a>>b; if(p2(b)>=a) cout<<p2(b)<<" "; else cout<<0; } } |