d124: 3的倍数
題目:http://zerojudge.tw/ShowProblem?problemid=d124
程式碼:
程式碼:
import java.math.BigInteger; import java.util.Scanner; public class d124 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); while(sc.hasNext()){ String n = sc.nextLine();//輸入數字 BigInteger num = new BigInteger(n); BigInteger three = new BigInteger("3"); BigInteger zero = new BigInteger("0"); if(num.mod(three).equals(zero)){ System.out.println("yes"); } else{ System.out.println("no"); } } } }
留言
張貼留言