package cn.itcast.girl.TheBlueCup_02;
import java.util.Scanner;
public class SavingsPlan {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int month[] = new int[13];
int balance=0;//余额.
int total=0;
// int bankrupt;
boolean flag = true;
for(int i=1;i<=12;i++) {
month[i] = sc.nextInt();
}
for(int i=1;i<=12;i++) {
int difference = 300 - month[i];
if(difference + balance < 0) {
flag = false;
System.out.println(-i);
break;
}else {
int divide = (difference + balance)/100;
balance = (difference + balance)%100;
total += 100*divide;
}
}
if(flag) {
System.out.println((int)(total+total*0.2+balance));
}
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)