#include using namespace std; int fight(int attx,int atty,int &hpx,int &hpy){ if (hpx<=0||hpy<=0) return 0; int r = min((hpx + atty - 1) / atty, (hpy + attx - 1) / attx); hpx -= r * atty; hpy -= r * attx; return r; } int main(){ int T; scanf("%d",&T); while (T--){ int a[3],ans=1e9; scanf("%d%d%d",&a[0],&a[1],&a[2]); for (int z=0;z<3;z++){ int x=z==0?1:0,y=z==2?1:2; int bre=1; for (int i=0;bre;i++){ int hpx=1000-a[y]*i,hpy=1000-a[x]*i,hpz=1000; if (hpx<=0||hpy<=0) bre=0; int now=i+fight(a[z],a[x],hpz,hpx); if (hpz>0) now+=fight(a[z],a[y],hpz,hpy); else if (hpx>0) now+=fight(a[x],a[y],hpx,hpy); ans=min(ans,now); } } printf("%d\n",ans); } }