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

目录

计算机组成原理部分: 

leetcode每日一题:

数据库部分:

牛客每日一题:

离散:


计算机组成原理部分: 

计算机储存信息的方式:

        计算机中的信息可以分为两大类: 控制信息数据信息 . (1) 控制信息用来控制计算机的工作 ; (2) 数据信息是计算机加工处理的对象 .

        1.在计算机常用数字代码表示的各类信息: a.用数字代码表示数值型数据 (0表示+ , 1表示-); b.用数字代码表示字符 (ascll码); c.用数字代码表示图像 (1表示高亮 , 2 表示暗淡); d.用数字代码表示声音 (相同的数字表示同一种HZ); e.用数字代码表示指令 (0000表示传送 , 0001表示加法 , 0010表示减法); f.用数字代码表示设备状态 (00表示空闲 , 01表示忙碌).

        2.在物理机制的基础上用数字信号表示数字代码 (电流的高低HZ).

IEE754的运算法则: 

        1.浮点的加减法运算: a. 对阶 (只有阶码相同的数 ,其尾数位的真正的权值才会相同 ,也才能够让尾数直接加减 ;b. 尾数相加减 ;c. 格式化结果 .

        2.浮点数的乘法运算: a. 对阶 (同上 ;b. 阶码的指数位相加 ( 2^E1 与 2^E2 -> E1 + E2 ;c. 尾数相乘 ;d. 格式化结果 .

        3.浮点数的除法运算: a. 对阶 (同上 ;b. 阶码的指数位相减 ( 2^E1 与 2^E2 -> E1 - E2 ;c. 尾数相除 ;d. 格式化结果 .

leetcode每日一题:

次元门

一道简单的模拟题 , 目标是两数差值要最小 , 所以第一反应便是 sqrt 附近的数 , 接下来暴力即可;

class Solution {
public:
    vector<int> constructRectangle(int area) {
        int m = sqrt(1.0 * area);
        while(area % m) m --;
        return {max(m , area / m) , min(m , area / m)};
    }
};

数据库部分:

--1. 按课程号降序显示选修各个课程的总人数、最高成绩、最低成绩及平均成绩;

select cno 课程号,MAX(grade) 最高成绩,min(grade) 最低成绩,avg(grade) 平均成绩
from sc
group by cno
order by cno desc

--2. 列出有二门以上课程(含两门)不及格的学生的学号及不及格门数;

select sno 学号,count(*) 不及格门数
from sc
where grade < 60
group by sno
having count(*) >= 2;

--3. 查询名字中第2个字为‘勇’的学生姓名和学号及选修的课程号、课程名;

select a.sname 学生姓名,a.sno 学号,b.cno 选课程号,cname 选课程名
from student a ,sc b,course c
where a.sname like '_勇%' and a.sno = b.sno and b.cno = c.cno 

--4. 查询至少选修了一门间接先行课为“5”号课程的学生姓名;

select distinct sname 学生姓名
from student a,sc b
where a.sno = b.sno and cno in (
    select cno
	from course
	where cpno = '5'
)

--5. 查询选修了“数据库”和“数学”两门课程的学生的学号;

select a.sno 学号
from student a,sc b,sc c,course d,course e
where b.cno = d.cno and c.cno = e.cno and b.sno = c.sno and a.sno = b.sno and d.cname = '数据库' and e.cname = '数学'

--6. 找出至少选修了“200515004”号同学所选修课程的学生学号;

select distinct a.sno 学号
from sc a
where not exists(
	select *
	from sc b
	where b.sno = '200515004' and not exists(
	    select *
		from sc c
		where a.sno = c.sno and c.cno = b.cno
	)
)
and a.sno <> '200515004'

--7. 找出“数据库系统”这门课成绩最高的学生学号,姓名;

select a.sno 学号,a.sname 姓名
from student a,sc b,course e
where a.sno = b.sno and b.cno=e.cno and e.cname = '数据库系统' and b.grade >= ALL (
    select c.grade
	from sc c,course d
	where c.cno = d.cno and d.cname = '数据库系统'
)

--8. 找出选修了“2”课程但没有选修“1”课程的学生姓名;

select distinct a.sname 姓名
from student a,sc b
where a.sno = b.sno and b.cno = '2' and not exists (
    select *
	from sc c,sc d
	where a.sno = c.sno and c.sno = d.sno and c.cno = '2' and d.cno = '1'
)

select a.sname 姓名
from student a,sc b
where a.sno = b.sno and b.cno = '2'
except 
select c.sname 姓名
from student c,sc d
where c.sno = d.sno and d.cno = '1'

--9. 找出被所有同学选修了的课程号;

select cno 课程号
from sc
except
select a.cno 课程号
from sc a
where exists(
    select *
	from student b
	where b.sno not in (
	    select c.sno
		from sc c
		where c.cno = a.cno
	)
)

--10. 查询没有选课的学生姓名。

select a.sname 学生姓名
from student a
where a.sno not in(
    select b.sno
	from student b,sc c
	where b.sno = c.sno
)

牛客每日一题:

次元门

贴的题解 , 还要琢磨 ( 头疼 

知识点 : bfs , 结构体 .

#include <bits/stdc++.h>
using namespace std;

const int maxn = 35;
int n,m,t,ans; ///ans 是正常出来的最短时间
char graph[maxn][maxn];
bool vis[maxn][maxn] = {0};
///上下左右
int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};

struct Point{
    int x,y,time;
    Point(){ time = 0; }
    Point(int a, int b, int c):x(a),y(b),time(c){}
}fi,st;

int bfs(){
    memset(vis,0,sizeof(vis));
    queue<Point> que;
    que.push(st);
    vis[st.x][st.y] = true;
    while (!que.empty()){
        Point head = que.front();
        que.pop();
        head.time ++;
        for (int i = 0;i < 4;i ++){
            int nx = head.x + dx[i];
            int ny = head.y + dy[i];
            if (nx < 0 || nx >= n || ny < 0 || ny >= m || vis[nx][ny] || graph[nx][ny] == '#') continue; ///不满足条件的格子 越界、已访问过、墙壁
            if(graph[nx][ny] == 'E') {
                //如果火到达终点所需要的时间,大于人走到这里的时间,说明能正常出去,返回时间
                if(max(abs(nx - fi.x), abs(ny - fi.y)) >= head.time)
                    return head.time;
            }
            if(max(abs(nx - fi.x), abs(ny - fi.y)) <= head.time) continue;
            vis[nx][ny] = true;
            que.push({nx, ny, head.time});
        }
    }
    return -1;
}

int main(){
    cin >> t;
    while (t --){
        cin >> n >> m;
        for (int i = 0;i < n;i ++){
            for(int j = 0;j < m;j ++){
                cin >> graph[i][j];
                if (graph[i][j] == 'S'){
                    st.x = i;
                    st.y = j;
                } else if (graph[i][j] == '*'){
                    fi.x = i;
                    fi.y = j;
                }
            }
        }
        int ans = bfs();
        if (ans != -1) cout << ans << endl;
        else cout << "T_T" << endl;
    }
    return 0;
}

离散:

积累知识点: 一阶逻辑范式 是不可以 存在 '非' 在最前端的 .

这是个第一人称的世界 , 现在由我来论证这一切.Day One -- 莫欺少年穷.

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值