/*跳一跳*/
import java.util.Scanner;
public class T7{
public static void main(String[] args) {
int t=0,f=0,value=0;
Scanner sc = new Scanner(System.in);
while((f=sc.nextInt())!=0){
switch(f) {
case 1: value = value+1; t = 1;break;
case 2: {
if(t==1) {
value = value+2;
t=2;
}else {
value = value+t+2;
t=t+2;
}
}
}
}
System.out.println(value);
}
}
CCF 201803-1 跳一跳
最新推荐文章于 2024-04-02 16:53:00 发布