美文网首页
普及组Day1教案

普及组Day1教案

作者: 学无止境1980 | 来源:发表于2019-08-14 20:16 被阅读0次

首先自己先注册好一个洛谷Luogu的账号,接下来三天都在上面刷题。上课前询问一下学生们有没有在这个网站上注册账号,如果他们都没注册你就可以跟他们介绍一下这个网站,这个网站上面有很多题,这些题按照涉及的不同算法和不同难度被分类,并且几乎每道题目都有题解,非常适合学OI的同学在上面刷题,题目刷多了就能提高自己的实力。

然后,开始考察一下学生的能力。学生是从海南来的,刚学完零基础的课程,差不多就是仅仅掌握C/C++语法的水平。所以先给他们几道模拟题,看他们的完成情况如何。有些题目这些学生可能之前做过,所以我这里准备了多几道题,选择其中1~2道布置给他们即可。在布置给他们之前,先询问“这道题做没做过?”,假如他们说做过,你就解释一下你找的题都是普及组入门的经典题,做过很正常,然后换一道题目给他们。

题目可从下面抽选(基本上都是模拟题,模拟的意思就是按照题目的要求用程序对计算过程进行简单的模拟,不涉及到其他任何算法或数据结构):

  1. Luogu P1055 ISBN号码
  2. Luogu P1008 三连击
  3. Luogu P1206 回文平方数 Palindromic Squares
  4. Luogu P1257 平面上的最接近点对
  5. Luogu P1328 生活大爆炸版石头剪刀布

这几道题目的AC(Accepted)代码我都附在后面。给他们一题比如最多40分钟的时间,如果到这个时间还有人没做出来,就可以把AC代码拿出来讲解,讲一下代码每一步在做什么,为什么要这样做。讲解完后让他们继续写,如果还写不出来就帮他们看代码、改代码,debug。如果有个别同学能力比较强,先做出来了,就安排他自己去做上面列表中的其他题目,不要让他们闲着没事干。

// Luogu P1055 ISBN号码
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
    char isbn[20];
    scanf("%s", isbn);
    int l = strlen(isbn), s = 0, t = 0;
    for (int i=0; t<9; i++)
        if ('0' <= isbn[i] && isbn[i] <= '9')
            s += (isbn[i] - '0') * (++t);
    s %= 11;
    char c = (s == 10) ? 'X' : ('0'+s);
    if (c == isbn[l-1]) printf("Right\n");
    else {
        isbn[l-1] = c;
        printf("%s\n", isbn);
    }
    return 0;
}
// Luogu P1008 三连击
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
    int used[10];
    for (int i=100; i<=333; i++) {
        for (int j=0; j<=9; j++) used[j] = 0;
        for (int j=1; j<=3; j++) {
            used[i*j/100]++;
            used[i*j/10%10]++;
            used[i*j%10]++;
        }
        bool ok = true;
        for (int j=1; j<=9; j++) if (used[j]!=1) ok = false;
        if (ok) printf("%d %d %d\n", i, i*2, i*3);
    }
    return 0;
}
// Luogu P1206 回文平方数 Palindromic Squares
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
    int B, x[30], x2[30];
    scanf("%d", &B);
    for (int i=1; i<=300; i++) {
        int t = i*i, len = 0, len2 = 0;
        while (t) {
            x2[len2++] = t % B;
            t /= B;
        }
        bool ok = true;
        for (int j=0; j<len2; j++) if (x2[j] != x2[len2-1-j]) ok = false;
        if (ok) {
            t = i;
            while (t) {
                x[len++] = t % B;
                t /= B;
            }
            for (int j=len-1; j>=0; j--) printf("%c", x[j]<10 ? x[j]+'0' : x[j]-10+'A');
            printf(" ");
            for (int j=len2-1; j>=0; j--) printf("%c", x2[j]<10 ? x2[j]+'0' : x2[j]-10+'A');
            printf("\n");
        }
    }
    return 0;
}
// Luogu P1257 平面上的最接近点对
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
int n;
double x[10000], y[10000], ans = 99999999999;
int main() {
    scanf("%d", &n);
    for (int i=0; i<n; i++) scanf("%lf %lf", &x[i], &y[i]);
    for (int i=0; i<n-1; i++)
        for (int j=i+1; j<n; j++) {
            double dis = sqrt((x[i]-x[j]) * (x[i]-x[j]) + (y[i]-y[j]) * (y[i]-y[j]));
            if (dis < ans) ans = dis;
        }
    printf("%.4lf\n", ans); // 使用.4lf格式控制符输出4位小数
    return 0;
}
// Luogu P1328 生活大爆炸版石头剪刀布
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
const int winlist[5][5] = {
    0, -1, 1, 1, -1,
    1, 0, -1, 1, -1,
    -1, 1, 0, -1, 1,
    -1, -1, 1, 0, 1,
    1, 1, -1, -1, 0
};
int n, na, nb, ga[300], gb[300];
int main() {
    scanf("%d %d %d", &n, &na, &nb);
    for (int i=1; i<=na; i++) scanf("%d", &ga[i]);
    for (int i=1; i<=nb; i++) scanf("%d", &gb[i]);
    int ia=0, ib=0, ansa=0, ansb=0;
    for (int i=1; i<=n; i++) {
        ia++;
        ib++;
        if (ia>na) ia=1;
        if (ib>nb) ib=1;
        if (winlist[ga[ia]][gb[ib]]>0) ansa += winlist[ga[ia]][gb[ib]];
        if (winlist[ga[ia]][gb[ib]]<0) ansb -= winlist[ga[ia]][gb[ib]];
    };
    printf("%d %d\n", ansa, ansb);
    return 0;
}

上面这些题目做完,预期是上午三小时就过去了。假如他们提前做完了,就继续讲后面的内容;假如他们没做完,就继续加快进度帮助他们debug把题目做完,或者跟他们说为了不耽误课程进度,这几道题目就先弄到这里为止,今天课程结束后大家回去自己找时间继续调试程序,如果有实在调试不出来的就把代码发给你,你晚上帮他们再仔细看看。课程进度可以自己灵活控制,不要太快了把准备的内容讲完了,也不要太慢了导致很多内容没讲。加快进度的方法是减少做题时间,尽早开始给他们展示讲解AC代码并帮他们debug,减慢进度的方法就是多布置几道题目给他们做。

下午的三小时课程,主要内容是教他们高精度运算。一般整数我们用int或long long存储进行运算,高精度运算就是用数组存储数字的每一位,实现运算。通过高精度运算我们可以实现计算2000位的整数乘以2000位的整数的结果,而直接用int或long long都肯定会溢出。高精度运算一般包括加、乘、除(没有减,因为减和加原理类似)。高精度加法最简单,乘法中等,除法最难。其中,高精度加法一般为高精加高精,高精度乘法一般分为高精乘低精和高精乘高精(这里的高精指用数组存储的数,而低精指普通的用int或long long存储的数)。

按照他们的能力和课程的时间,如果他们掌握速度快就可以讲完高精度除法,如果速度慢讲完高精度加法、乘法就可以了。假如他们之前学过高精度也没有关系,下面的题目当作对于他们学习情况的检验。

洛谷上高精度的模板题有:

  1. 高精度加法:Luogu P1601 A+B Problem(高精)
  2. 高精度减法:Luogu P2142 高精度减法
  3. 高精度乘法(高精乘低精):Luogu P1009 阶乘之和
// Luogu P1601 A+B Problem(高精)
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
char s1[510], s2[510];
int a[510], b[510], c[510];
int main() {
    scanf("%s%s", s1, s2);
    int len1 = strlen(s1), len2 = strlen(s2);
    // 将读入的字符串反过来存成int,高位在右低位在左
    for (int i=0; i<len1; i++) a[i] = s1[len1-1-i] - '0';
    for (int i=0; i<len2; i++) b[i] = s2[len2-1-i] - '0';
    int len = max(len1, len2);
    for (int i=0; i<len; i++) {
        c[i] += (a[i] + b[i]);
        c[i+1] = c[i] / 10;
        c[i] %= 10;
    }
    while (c[len]) {
        c[len+1] = c[len] / 10;
        c[len] %= 10;
        len++;
    }
    for (int i=len-1; i>=0; i--) printf("%d", c[i]);
    printf("\n");
    return 0;
}
// Luogu P1009 阶乘之和
// 这是一道涉及高精加高精和高精乘低精的题目
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
int S[1000], lens;
int T[200], lent;
int main() {
    int N; scanf("%d", &N);
    T[0] = 1;
    lent = 1;
    for (int i=1; i<=N; i++) {
        for (int j=0; j<lent; j++) T[j] *= i;
        for (int j=0; j<lent; j++) {
            T[j+1] += T[j] / 10;
            T[j] %= 10;
        }
        while (T[lent]) {
            T[lent+1] = T[lent] / 10;
            T[lent] %= 10;
            lent++;
        }
        // 上面代码算出i的阶乘,用数组T表示
        lens = max(lens, lent);
        for (int j=0; j<lens; j++) S[j] += T[j];
        for (int j=0; j<lens; j++) {
            S[j+1] += S[j] / 10;
            S[j] %= 10;
        }
        while (S[lens]) {
            S[lens+1] = S[lens] / 10;
            S[lens] %= 10;
            lens++;
        }
        // 上面的代码将T加到S中
    }
    for (int i=lens-1; i>=0; i--) printf("%d", S[i]);
    printf("\n");
    return 0;
}

相关文章

  • 普及组Day1教案

    首先自己先注册好一个洛谷Luogu的账号,接下来三天都在上面刷题。上课前询问一下学生们有没有在这个网站上注册账号,...

  • 普及组Day2教案

    递归专题 P1157 组合的输出 Luogu P2386 放苹果

  • 普及组Day3教案

    栈:栈就是先进后出,比如我把数字3、5、2放入栈中,然后第一次从栈中取出来的数字是2,然后取出来的数字是5,这时如...

  • 诲人不倦2018-05-02

    《诲人不倦》教案 语文组骨干教师公开课教案 徐红辉 http://www.edudo.com/85541 【教学目...

  • 大数据学习1-linux

    day1 用户和用户组管理 权限管理

  • 杜尔伯特历史分享

    杜尔伯特科技普及(一)。1956年,科学普及协会开始有计划有目的组织开展科学普及活动。各学组、会员工作组利用举办讲...

  • 开场舞蹈 #普及组#

    题目 Problem Description 在全世界人民的期盼下,2008年北京奥林匹克运动会终于隆重召开了! ...

  • 2班4组+开营仪式感悟

    标题:【2班4组】+ Day1 正文: 【学员信息】39-花开,一路-day1 【作业要求】开营仪式感悟分享 【作...

  • 写作训练营

    【2班1组】Day1《开营仪式收获》 【学员信息】81-锐清-Day1 【作业要求】《开营仪式收获》 【作业如下 ...

  • 景泰一中第三十届“双研会”优秀教案作业展评

    1.各教研组按照《景泰一中优秀教案评选标准》、《景泰一中作业批改优秀评选标准》推荐优秀教案和批改优秀作业参...

网友评论

      本文标题:普及组Day1教案

      本文链接:https://www.haomeiwen.com/subject/bvamjctx.html