Question Description: Cithra now wants to decorate his house by Artificial flower jars. She plans to buy exactly "N" ones. She can only buy them from Pandian Store. There are only two kind of Artificial flower jars available in that shop. The shop is very strange. If you buy "X" Artificial flower jars of kind 1 then you must pay A*X^2 and B*Y^2 if you buy "Y" Artificial flower jars of kind 2. Please help Cithra buys exactly "N" Artificial flower jars that minimizes money she pays. Constraints: 1 <= T <= 10^5 1 <= N, A, B <= 10^5
C Program


#include <stdio.h>

int main(){

    int T;

    scanf("%d",&T);

    while(T--){

        long long N,A,B,total=0;

        scanf("%lld %lld %lld",&N,&A,&B);

        long long arr[2];

        arr[0]=A;

        arr[1]=B;

        while(N>0){

            if(arr[0]<=arr[1]){

                total+=arr[0];

                arr[0]+=2*A;

            }else{

                total+=arr[1];

                arr[1]+=2*B;

            }

            N--;

        }

        printf("%lld\n",total);

    }

    return 0;

}