0
点赞
收藏
分享

微信扫一扫

Java POJ 细胞繁殖

E_topia 2022-03-26 阅读 21
java

public class Main1{
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        int n=sc.nextInt();
        for(int i=0;i<n;i++) {                             
            int a=sc.nextInt();
            int b=sc.nextInt();
            int c=sc.nextInt();
            int d=sc.nextInt();
            int e=sc.nextInt();
            int time = 0;
            int count;
            if(a==d) {
                time=e-b;
                count=(int) (c*Math.pow(2, time));
                System.out.println(count);
            }
            else {
                for(int j=a;j<d;j++) {
                    if(j==2) {
                        time+=28;
                    }
                    if(j==1||j==3||j==5||j==7||j==8||j==10||j==12) {
                        time+=31;
                    }if(j==4||j==6||j==9||j==11) {
                        time+=30;
                        
                    }
                        
                }
                time=time+e-b;
                count=(int) (c*Math.pow(2, time));
                System.out.println(count);
            }
            
        }
        
    }
}

举报

相关推荐

0 条评论