why do i get a runtime error in java?

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--;
	        }
	}
}

JOptionPane is your progblem, see FAQ, especially section “How should I test my program”.

1 Like

@g_coder:The solution/code that you posted is the solution of one of the problem From the Live Contest going on ,at codechef.Please don’t post the code/solution of the running contest for ,peer review or suggestion or for any help.Such an act leads to suspension of account .Refer the guidelines http://discuss.codechef.com/questions/855/what-kind-of-comment-should-i-post-on-the-problem-page.