i used java to write the code for LECANDY problem. the code is running well on my local machine. but while submitting it on codeshef i get an error “runtime error”. please help me. here is the code…
class a1
{
public static void main(String s[])
{
long c;
int t,n,i,sum;
int a;
t=Integer.parseInt(javax.swing.JOptionPane.showInputDialog(null,"enter t"));
while(t>0)
{
n=Integer.parseInt(javax.swing.JOptionPane.showInputDialog(null,"enter n"));
c=Long.parseLong(javax.swing.JOptionPane.showInputDialog(null,"enter c"));
sum=0;
for(i=0;i<n;i++)
{
a=Integer.parseInt(javax.swing.JOptionPane.showInputDialog(null,"enter a"));
sum=sum+a;
}
if(sum <= c)
System.out.println("Yes");
else
System.out.println("No\n");
t--;
}
}
}