Atoms at the corner share themselves with 8 other unit cells. Since there are 8 corners in a a unit cell,
No of atoms of A in one unit cell =
Atoms at the faces share themselves with 2 other unit cells. Since there are 6 faces in a unit cell,
No of atoms of B in one unit cell =
Therefore, the formula of compound is AB3.