Cod sursa(job #284908)
Utilizator | Data | 22 martie 2009 01:46:58 | |
---|---|---|---|
Problema | Stramosi | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include<fstream.h>
int main(){
ifstream fin("stramosi.in");
ofstream fout("stramosi.out");
int p,q,rr,count,varza,stramos;
fin>>p>>q;
stramos=p;
while (q>0) {
rr=1; count=0; varza=q;
while (varza>0) {count++; varza/=2;rr*=2;} rr/=2; count--;
q-=rr;
stramos=v[count][stramos];
rr/=2;
count--;
}
fout<<stramos<<'\n';
return 0;
}