解题思路:
注意事项:
参考代码:
package Sixteen;
import java.util.Scanner;
public class 短信计费 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double sum=0.0;
int x=0,y=0;
int n=sc.nextInt();
for (int i = 1; i <=n ; i++) {
int a=sc.nextInt();
if(a<=70)
sum+=0.1;
if(a>70)
{
if(a%70==0){
x=a/70;
for (int j = 1; j <=x ; j++)
sum+=0.1;
}
else if(a%70!=0){
y=a/70;
for (int j = 1; j <=y+1 ; j++)
sum+=0.1;
}
}
}
System.out.printf("%.1f",sum);
}
}
0.0分
1 人评分