“21 天好习惯”第一期-20

目录

数据库知识点:

英语作文:

leetcode每日一题:


数据库知识点:

实体完整性完整性:

        定义: 数据的完整性是指 数据的 正确性 相容性.

        设立主码:

--1.在列级定义主码.
--eg:
sno char(9) primary key --列名 和 数据类型 可换.

--2.在表级定义主码.
--eg:
primary key (sno , cno) --列名可换.

       primary key 语句的作用: 每当用户程序对基本表插入一条记录  对主码列进行更新操作时 , 关系数据库管理系统将进行以下完整性检查:

                1. 检查主码值是否唯一 , 如果不唯一则拒绝插入或修改.

                2. 检查主码的各个属性是否为空 , 只要有一个为空就拒绝插入或修改.

参照完整性:

        定义: 将两个表相应元组关联起来. (这样修改 , 删除 , 添加就会相关联.

        当破坏参照完整性时: 

         级联操作:

--级联删除:
on delete cascade

--级联更新:
on update cascade

--拒绝删除:
on delete no action

--拒绝更新:
on update no action

英语作文:

题目: my best mistake.

As we all know, people will make many big or small mistakes in their lives, so that they will be unable to remember and regret in the days to come. One such thing happened when I was very young. I just want to use my youthful ignorance to cover up my bad deeds.    

        The habits that people develop in this life are mostly determined by what they did and what they saw in childhood. As a boy, I like the robot toys shown on TV as much as most people. But I My family is not rich, and I can’t even think about buying the cheapest robot. And everything seems to be calculated. I wandered outside the canteen for a long time, and the robot player who watched for a long time was taken to the class by a classmate The greed that belongs to a child makes me move my mind.    

        After careful planning, I finished my lunch ahead of schedule, and took the toys away quickly while the other classmates had not yet returned to the classroom, and hid them in the toilet. When the classmate who lost the toy was distraught, I always kept turning a blind eye. Perhaps. I dare not look into his eyes.    

        After returning home, I carefully protected it from being discovered by my mother, but there will still be a day. However, my mother did not blame me. While teaching me again, I promised to buy me a robot on my birthday. I will also be after. I have been taking it as a warning in my days.     It is not terrible to make mistakes, and to have the determination to recognize and correct them is what we should care about.

leetcode每日一题:

次元门

题意: 题目说的很明确了 , 没必要过多的解释.

解题: 开始的第一反应是找除1外有多少个因数 , 因为除1外因数为偶数的就是亮的. 然后开始打表发现了这样的规律.

//打表找规律
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(void){
    for(int i = 1;i <= 100;i ++){
        int num = i , cnt = 2 , sum = 0;
        while(num >= cnt){
            if(num % cnt == 0) sum ++;
            cnt ++;
        }
        cout << num << ' ' << sum;
        if(sum % 2 == 0) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

通过查表 , 你会发现 , 只有是平方数才会亮. 所以我们只要统计有多少个平方数就行了.

class Solution {
public:
    int bulbSwitch(int n) {
        return sqrt(n);
    }
};

所谓骑士 即使照亮整片大陆的崇高者. Day Twenty -- 一梦姑苏城.

猜你喜欢

转载自blog.csdn.net/EX_fish/article/details/121278910