First Snow

One day Tomato woke up late in the morning and realized that she had a long list of todos. Frantically, she wore her overcoat and ran outside with her bag. But, as she got out of the house and ran for the bus stop, she noticed that everything around her is snowy white. She can’t figure out the foot path from the road. This is the first time she is seeing snow. ^.^


This is a companion discussion topic for the original entry at https://toph.co/p/first-snow
#include <iostream>

using namespace std;

int main()
{
    int n,x,d,t=0;
    cin>>n>>x>>d;
    int snwd[n];
    int snwr[n];
    for(int i=1;i<=n;i++)
    {
        cin>>snwd[i];
    }
    for(int i=1;i<=n;i++)
    {
        //cout<<snwd[i]<<"For I"<<endl;
        for(int j=1;j<=n-i;j++)
        {
            if(snwd[i]-d>=0)
            {
                snwd[i]=snwd[i]-d;
                //cout<<snwd[i]<<"For J"<<endl;
            }else
            {
                snwd[i]=0;
                //cout<<"Discarded"<<endl;
                break;
            }
        //cout<<snwd[i]<<"For I2"<<endl;
        }
        t+=snwd[i];
        //cout<<t<<"T"<<endl;
        if(t>=x)
        {
            return cout<<i , 0;
            break;
        }
    }
}

Why it is missing test case 5… More accurate, what is test case five?