for the easy level question Birthday Candles : http://www.codechef.com/problems/CANDLE/ i have tried all the test cases that i could but i m still getting wrong answer. Please tell me the tell case for which my code is failing or tell me the error that i am able to find. Here is the code :
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int arr[10];
for(int i=0;i<10;i++)
cin>>arr[i];
int min_value=arr[1],min_index=1;
for(int i=1;i<10;i++)
{
if(min_value>arr[i])
{
min_value=arr[i];
min_index=i;
}
}
if(min_value>arr[0])
{
min_value=arr[0];
min_index=0;
}
if(min_value==0&&min_index==0)
cout<<10<<endl;
else if(min_value==0)
cout<<min_index<<endl;
else if(min_index==0)
{
int age=1;
for(int i=0;i<min_value;i++)
age*=10;
cout<<age<<endl;
}
else
{
int age=min_index;
for(int i=0;i<min_value;i++)
age=min_index*10+min_index;
cout<<age<<endl;
}
}
}