import java.util.Scanner; //小球落地反弹球下落总高度和你想要得那次弹起得高度
public class xiaoQiuLuoDiFanTan {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("请输入初始下降高度和弹跳次数和想要得次数得弹起高度");
double heigh=sc.nextInt();
int times=sc.nextInt();
int times2=sc.nextInt();
fanTan(heigh,times,times2);
}
public static void fanTan(double hei,int time,int time1){
double sum=hei;
hei=hei/2.0;
for(int i=1;i<time;i++)
{
sum=sum+hei*2;
hei=hei/2;
if (hei==0){break;}
if (i==time1-1){
System.out.println(hei);
}
}
System.out.println(sum);
}
}
import java.util.Scanner; //取输入的三科成绩得平均值和最大值,最小值,和代数和
public class chengJi {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("请输入三科成绩");
double s1=sc.nextDouble();
double s2=sc.nextDouble();
double s3=sc.nextDouble();
jiSuan(s1,s2,s3);
}
public static void jiSuan(double score1, double score2,double score3){
System.out.println("三科平均分"+(score1+score2+score3)/3);
System.out.println("三科总分"+(score1+score2+score3));
double max,min;
if (score1>score2){
max=score1;
min=score2;
if(max>score3);
else {max=score3;}
if (min<score3);
else {min=score3;}
}
else{
max=score2;
min=score1;
if(max>score3);
else {max=score3;}
if (min<score3);
else {min=score3;}
}
System.out.println("最大值"+max);
System.out.println("最小值"+min);
}
}
import java.util.Scanner; //数组转置
public class shuZuZhuanZhi {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int l=sc.nextInt();
int[] n = new int[l];
for(int i=0;i<l;i++) {
n[i] = sc.nextInt();
}
zhuanZhi(n);
}
public static void zhuanZhi(int [] s){
for (int i=0;i<s.length/2;i++){
int q;
q=s[i];
s[i]=s[s.length-i-1];
s[s.length-i-1]=q;
}
for(int j=0;j<s.length;j++){
System.out.print(s[j]+" ");
}
}
}
public class shuZuHeBing { //数组按大小合并
public static void main(String[] args) {
heBing();
}
public static void heBing()
{
int [] A={1,7,5,7,9,2,21,13,45};
int [] B={2,5,8,14,21};
int [] C=new int [A.length+B.length];
System.arraycopy(A, 0, C, 0, A.length);
System.arraycopy(B, 0, C, A.length, B.length);
for(int i=0;i<C.length;i++)//冒泡排序
{
for(int j=0;j<C.length-1-i;j++)
{
int temp;
if(C[j]>C[j+1])
{
temp=C[j+1];
C[j+1]=C[j];
C[j]=temp;
}
}
}
for(int n=0;n<C.length;n++)
{
System.out.print(C[n]+" ");
}
}
}