candles:wrong answer

#include <stdio.h>
#include <stdlib.h>

 int main()
 {
    int t;
 scanf("%d",&t);
while(t--)
{
    int i,A[11]={0};
    for(i=0;i<10;i++)
    {
        scanf("%d",&A[i]);
    }
    int minm=A[0],m=0;
    for(i=1;i<10;i++)
    {
        if(A[i]<minm)
        {
            minm=A[i];
           m=i;
        }

        if(A[i]==minm)
        {
               m=m<i?m:i;
        }

    }

    if(m==0)
    {
        printf("1");
        for(i=0;i<=minm;i++)
            printf("0");
    }

    else
    {
        for(i=0;i<=minm;i++)
            printf("%d",m);
    }printf("\n");
}
return 0;

}

Here is the test case

1
0 0 1 1 1 1 1 1 1 1

Output should be 1. Your code gives 10.
If you want some more help, you can have a look at my submission.