This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner scn = new Scanner(System.in); | |
while(scn.hasNext()){ | |
String arr[]=scn.nextLine().split(" "); | |
int count=0; | |
for(int i=1;i<=10;i++){ | |
if(Integer.parseInt(arr[i-1])%i!=0) | |
count++; | |
} | |
if(count<=3) | |
System.out.println("yes"); | |
else | |
System.out.println("no"); | |
} | |
} | |
/*題目:C_AR92-易 和尚端湯上塔 | |
作者:1010 | |
時間:西元 2017 年 4 月*/ | |
} |
這題就是把每位數去除若無法整除就表示滑倒,滑倒3次以內(包含3)就輸出yes反之
總共十層所以被除數依序從1~10
沒有留言:
張貼留言