public class Jump {
public int score(){
int newScore=0;
Scanner scanner = new Scanner(System.in);
int n=scanner.nextInt();
int middleNum=0;
while(n!=0){
if(n==1){
newScore++;
middleNum=0;
}
else if(n==2){
newScore=newScore+2+2*middleNum;
middleNum++;
}
n=scanner.nextInt();
}
return newScore;
}
}
CCF练习(java)——跳一跳
最新推荐文章于 2021-05-15 13:22:33 发布