Result: Accepted
Time: 1ms
Memory: 1092kB
/*#include<stdio.h>
#include<stdlib.h>
struct ss
{
int n,m;
};
int comp(const void *p,const void *q)
{
return ((struct ss *)p)->m-((struct ss *)q)->m;
}
int main(void)
{
int t,x,y,g,k,i,h;
struct ss a[100];
scanf("%d",&t);
while(t--)
{
scanf("%d",&h);
g=0,k=0;
for(x=0;x<=h/2;++x)
{
for(y=0;y<=h/3;++y)
{
if(x*2+y*3==h)
{
a[k].m=x;
a[k].n=y;
g=1;
}
else
{
a[k].m=2500;
a[k].n=2500;
}
k++;
}
}
if(g==0)
printf("WA\n");
else
{
qsort(a,k,sizeof(struct ss),comp);
printf("%d %d\n",a[0].m,a[0].n);
}
}
return 0;
}*/
#include<stdio.h>
int main(void)
{
int t,x,y,h,m,g;
scanf("%d",&t);
while(t--)
{
scanf("%d",&h);
g=0;
for(x=0;x<=h/2;++x)
{
m=h;
m=m-2*x;
if(m%3==0)
{
printf("%d %d\n",x,m/3);
g=1;
break;
}
}
if(g==0)
printf("WA\n");
}
return 0;
}