My issue
Warning: File ./Codechef.class does not contain class Codechef
Error: Could not find or load main class Codechef
Caused by: java.lang.NoClassDefFoundError: codechef/Codechef (wrong name: Codechef)
My code
package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc=new Scanner(System.in);
int N=sc.nextInt();
int S[]=new int[N];
int T[]=new int[N];
String Leader[]=new String[N];
int Lead[]=new int[N];
for(int i=0;i<N;i++)
{
S[i]=sc.nextInt();
T[i]=sc.nextInt();
}
for(int i=0;i<N;i++)
{
if(S[i]>T[i])
{
Leader[i]="player1";
Lead[i]=S[i]-T[i];
}
else
{
Leader[i]="player2";
Lead[i]=T[i]-S[i];
}
}
int p1c=0,p2c=0;
for(int i=0;i<N;i++)
{
if(Leader[i]=="player1")
p1c+=Lead[i];
else
p2c+=Lead[i];
}
if(p1c>p2c)
{
System.out.println("1 "+p1c);
}
else
System.out.println("2 "+p2c);
}
}
Problem Link: CodeChef: Practical coding for everyone