Chef and Street Food (STFOOD)

So, I encountered this problem. It’s a easy problem. I got the logic as well. It passes the custom test cases but gives me WA on submission. Can someone point me what is wrong with my code ?
Link : https://www.codechef.com/LRNDSA02/problems/STFOOD

import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
	public static void main (String[] args)
	{
	    Scanner in = new Scanner(System.in);
	    int t = in.nextInt();
	    while(t-- > 0) 
	    {
	        int n = in.nextInt();
	        int[][] A = new int[n][3];
	        for(int i = 0; i < n; i++)
	        {
	            for(int j = 0; j < 3; j++)
	            {
	                A[i][j] = in.nextInt();
	            }
	        }
	        int ans = calc(A, n);
	        System.out.println(ans);
	    }
	}
	public static int calc(int[][] A, int n)
	{
	    int ans = 0;
	    for(int i = 0; i < n; i++)
	    {
            int numberOfPeople = A[i][2] / (A[i][0] + 1);
            int maxProfit = numberOfPeople * A[i][1];
            ans = Math.max(ans, maxProfit);
	    }
	    return ans;
	}
}

bro, in your function calc,
you have taken A[i][2] as no. of total people.
but that should be A[i][1].

just correct these line:

int numberOfPeople = A[i][1] / (A[i][0] + 1);
int maxProfit = numberOfPeople * A[i][2];

1 Like

Ohh yes, Thank you so much.

1 Like

welcome