笔试强训14天

目录

选择题

 编程题 


选择题

  •  为什么不满足第三范式,因为存在有属性跟主机存在间接关系,比如学号能得到所在系,但是所在系能得到所在系主任,所在系主任跟主键不是直接关系

 

  • 聚合函数只能使用数字类型的列

 

 

 编程题 

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Scanner sc=new Scanner(System.in);
        int y=sc.nextInt();
        int m=sc.nextInt();
        int d=sc.nextInt();
        int days[]={31,59,90,120,151,181,212,243,273,304,334,365};
        int sum=0;
        if(m>=2){
            sum+=days[m-2];
        }
        sum+=d;
        if(m>2){
            if((y%100==0&&y%400==0)|| (y%100!=0&&y%4==0)){
                sum+=1;
            }
        }
        System.out.println(sum);
    }
}

 

 


import java.util.Arrays;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int []arr=new int[n];
        for (int i = 0; i < arr.length; i++) {
            arr[i]=sc.nextInt();
        }
        Arrays.sort(arr);
        int count=count(arr,n,0,0,1);
        System.out.println(count);
    }

    private static int count(int[] arr, int n, int pos, int sum, int multi) {
        int count=0;
        for (int i = pos; i < n; i++) {
            sum+=arr[i];
            multi*=arr[i];
            if(sum>multi){
                count=count+1+count(arr,n,i+1,sum,multi);
                //这里就是往后找
                //数组是 1 1 3 5
                //比如 1 1 可以 继续往后找 1 1 3
            }else if(arr[i]==1){
                count=count+count(arr,n,i+1,sum,multi);
            }else {
                break;
            }
            sum-=arr[i];
            multi=multi/arr[i];
            //这里是往上层回溯
            //数组是 1 1 3 5
            //比如 1 1 3 5不可以了 可以回溯到上层变成1 1 然后去试一试 1 1 5
            while (i<n-1&&arr[i]==arr[i+1]){
                i++;
                //因为我们这里面的小球除了数字不一样,其他都一样
                //数组是1 1 3 3 4
                //比如我们找到 1 1 3
                //如果没有这一步,我们就会将 1 1 3 再算一遍
            }
        }
        return count;
    }
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

库里不会投三分

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值