Help me in solving LPYAS151 problem

My issue

Is there any mistake in my approach hidden test cases are failed.

My code

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

class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner Sc = new Scanner(System.in);
		int N = Sc.nextInt();
		int rem,sum=0,temp;
		temp=N;
		while(N>0){
		    rem = N%10;
		    sum = sum+(rem*rem*rem);
		    N = N/10;
		}
		if(temp==sum){
		    System.out.println("Armstrong");
		}else{
		    System.out.println("Not Armstrong");
		}
		Sc.close();
	}
}

Learning course: Roadmap to 3*
Problem Link: https://www.codechef.com/learn/course/klu-roadmap-3star/KLURMP300B/problems/LPYAS151