Number Crafting

Limits: 1s, 512 MB

Game is one type of competency, and when it befalls by any number its really astonish.


This is a companion discussion topic for the original entry at https://toph.co/p/number-crafting
int t;

   cin >> t;

   while (t--)

   {

      ll n;

      ll sum = 0;

      cin >> n;

      ll ara[n];

      for (ll i = 0; i < n; i++)

      {

         cin >> ara[i];

         sum += ara[i];

      }

      sort(ara, ara + n);

      ll res = sum / ara[0];

      bool sign = false;

      for (int i = 0; i < n; i++)

      {

         if (ara[i] == res)

         {

            cout << i + 1 << " ";

            sign = true;

         }

      }

      if (!sign)

         cout << "NULL";

      cout << endl;

   }

input output same but saying WA at 1!! ???

i think these types of problems are huge waste of time,it doesnt can teach U anythinG ! if u want to make a tricky problem try to set the trick into problem not into printing spaces or something like that!!!

int t;

cin >> t;

while (t--)

{

    ll n;

    ll sum = 0;

    cin >> n;

    ll ara[n];

    for (ll i = 0; i < n; i++)

    {

        cin >> ara[i];

        sum += ara[i];

    }

    sort(ara, ara + n);

    ll res = sum / ara[0];

    bool sign = false;

    bool first = false;

    for (int i = 0; i < n; i++)

    {

        if (ara[i] == res)

        {

            if (first)

                cout <<" ";

            cout << i + 1;

            first = true;

            sign = true;

        }

    }

    if (!sign)

        cout << "NULL";

    cout << endl;

}

last case WA…! Are you there ?