2022年1月17日学习总结

9:00~9:30
听一篇英语听力
9:30~11:00
做一套英语试卷
12:00~14:30
辅导妹妹高中数学和英语
14:30~18:00
AC昨天测试的补题


第一题:

CF18B

Platforms

题目描述

In one one-dimensional world there are nn platforms. Platform with index kk (platforms are numbered from 1) is a segment with coordinates [(k-1)m,(k-1)m+l][(k−1)m,(k−1)m+l] , and l

输入格式

The first input line contains 4 integer numbers nn , dd , mm , ll ( 1<=n,d,m,l<=10^{6},l

输出格式

Output the coordinates of the point, where the grosshopper will fall down. Don't forget that if Bob finds himself on the platform edge, he doesn't fall down.

题意翻译

题目描述:在一坐标轴上给出n块板子,每个板子所占的空间为[(k-1)m,(k-1)m+l](l

Translated by 稀神探女

输入输出样例

输入 #1复制

2 2 5 3

输出 #1复制

4

输入 #2复制

5 4 11 8

输出 #2复制

20

题解:青蛙在本题目中一共有两种情况。一种是不在板子上,跳到两个板子中间最后或者跳出了最后一个板子。直接遍历每块板子,当青蛙跳不到这一块板子上结束循环,能跳上该板子就让它一直跳直到跳出该板子。

AC代码:

#include
using namespace std;
int main()
{
    long long n,d,m,l,ans,i;
    cin>>n>>d>>m>>l;
    ans=0;
    for(i=1;i<=n;i++) {
        if(ans<((i-1)*m))  break;//若是不能调到板子上,就结束
        while(ans<=(i-1)*m+l)   ans=(((i-1)*m+l)/d)*d+d;//继续跳,直到跳出这块板子
    }
    cout<     return 0;
}

后面想做最后一个题目发现不会做

便继续学习树和二叉树。

树是由n(n>=1)个有限结点组成一个具有层次关系的集合。把它叫做“树”是因为它看起来像一棵倒挂的树,也就
是说它是根朝上,而叶朝下的。

二叉树的定义:

二叉树就是度不超过2的树(每个结点最多有两个子结点)。上面那张图就是二叉树。

满二叉树:
一个二叉树,如果每一个层的结点树都达到最大值,则这个二叉树就是满二叉树。

然后学习了一下如何创建和如何遍历二叉树。

明天试着AC一下本周的题目!

你可能感兴趣的:(p2p,linq,蓝桥杯)