欢迎光临
我们一直在努力

【day12】

题目:有一家生化所,一月份引入一对新生的小白鼠。这对小白鼠生长两个月后,在第三、第四、第五个月各繁殖一对新小白鼠,在第六个月停止繁殖,在第七个月则死亡。新生的小白鼠也如此繁殖。问在第N个月时,活的小白鼠有多少对?

个人总结:

  • 找出规律:现存小鼠数量=上个月小鼠数量+当月新生小鼠-前第六个月的新生小鼠数量
  • 当月新生小鼠数量由前2~4个月的新生小鼠数量决定
  • #include<iostream>
    using namespace std;
    int main() {
    int pre = 0;
    int live[51] = { 0,1,1,2,3,5,7,10,15 };
    int newm[51] = { 0,0,0,1,1,2,2,4,5 };
    for (int i = 9; i < 51; i++) {
    pre = 0;
    for (int j = i – 4; j < i – 1; j++) {
    pre += newm[j];
    }
    live[i] = live[i – 1] + pre – newm[i – 6];
    newm[i] = pre;
    }
    int n;
    while (cin >> n) {
    cout << live[n] << endl;
    }
    return 0;
    }

    题目:有一种自然数,它的各位数字之和能被17整除。这个数的后继数(即这个数加1)的各位数字之和也能被17整除。求所有自然数中,从小到大第n个这样的数。

    个人总结:

  • 函数addall计算所有数字之和,方便计算(跟前面有道题过程一样)
  • 8899是第一个,所以从它开始即可
  • 当计数用的i=n时结束循环
  • #include<iostream>
    using namespace std;
    int addall(int n) {
    int sum = 0;
    while (n != 0) {
    sum += n % 10;
    n /= 10;
    }
    return sum;
    }
    int main() {
    int n;
    while (cin >> n) {
    int cnt = 8899;
    int i = 1;
    while (1) {
    if (addall(cnt) % 17 == 0 && (addall(cnt + 1)) % 17 == 0) {

    if (i == n) {
    cout << cnt << endl;
    break;
    }
    i++;
    }
    cnt++;
    }
    }
    return 0;
    }

    题目:一个整数,只知道前几位为a,不知道末二位,被另一个整数b除尽了(即没有余数),那么该数的末二位该是什么呢?

    程序已完成主体框架,请完成以下函数getResult的函数体。

    getResult的功能为:

        根据传入的参数a和b,求出所有符合条件的末二位(尾数)放入数组weishu中,数组weishu按升序排列。函数返回符合条件的尾数个数。

    //以下代码可自行修改成C++代码

    #include <stdio.h>

    int getResult(int a, int b, int weishu[])

    {

    //请完成此函数

    }

    int main()

    {

    int a, b, weishu[100],count,i;

    scanf("%d%d", &a, &b);

    count=getResult(a,b,weishu);

    for(i=0; i<count; i++)

    {

    if (i>0)

    printf(" ");

    printf("%02d", weishu[i]);

    }

    printf("\\n");

    return 0;

    }

    个人总结:

  • 从0~99开始尝试,放入weishu数组中就是按升序排列的
  • #include <stdio.h>
    using namespace std;
    int getResult(int a, int b, int weishu[])

    {
    int cnt = 0, s = 0;
    a *= 100;
    for (int i = 0; i < 100; i++) {
    s = a + i;
    if (s % b == 0) {
    weishu[cnt] = i;
    cnt++;
    }
    }
    return cnt;

    }

    int main()

    {

    int a, b, weishu[100], count, i;

    scanf("%d%d", &a, &b);

    count = getResult(a, b, weishu);

    for (i = 0; i < count; i++)

    {

    if (i > 0)

    printf(" ");

    printf("%02d", weishu[i]);

    }

    printf("\\n");

    return 0;

    }


    Translation:

    In the past the Turing test (proposed by Alan Turing in1950) has served as a benchmark in measuringprogress in the field of artificial intelligence. Today thesignificance of the Turing test has faded although itremains an important part of the artificial intelligencefolklore. Turing's proposal was to allow a human,whom we call the interrogator, to communicate with atest subject by means of a typewriter system without being told whether the test subject was a human or amachine. In this environment, a machine would bedeclared to behave intelligently if the interrogator wasnot able to distinguish it from a human. Turingpredicted that by the year 2000 machines would have a30 percent chance of passing a five-minute Turing test—a conjecture that turned out to be surprisinglyaccurate.

          One reason that the Turing test is no longer consideredto be a meaningful measure of intelligence is that aneerie appearance of intelligence can be produced withrelative ease. A well-known example arose as a result ofthe program DOCTOR (a version of the more generalsystem called ELIZA) developed by Joseph Weizenbaum[插图] in the mid1960s. This interactive program wasdesigned to project the image of a Rogerian analyst[插图]conducting a psychological interview; the computerplayed the role of the analyst while the user played thepatient. Internally, all that DOCTOR did was restructurethe statements made by the patient according to somewell-defined rules and direct them back to the patient.For example, in response to the statement "I am tiredtoday," DOCTOR might have replied with "Why do youthink you're tired today?" If DOCTOR was unable torecognize the sentence structure, it merely respondedwith something like "Go on" or "That's very interesting."

    Weizenbaum's purpose in developing DOCTOR dealtwith the study of natural language communication. Thesubject of psychotherapy merely provided anenvironment in which the program could"communicate." To Weizenbaum's dismay, however,several psychologists proposed using the program foractual psychotherapy. (The Rogerian thesis is that the      patient, not the analyst, should lead the discussionduring the therapeutic session, and thus, they argued,a computer could possibly conduct a discussion as wellas a therapist could.) Moreover, DOCTOR projected theimage of comprehension so strongly that many who"communicated" with it became subservient to themachine's question-and-answer dialogue. In a sense,DOCTOR passed the Turing test. The result was thatethical, as well as technical, issues were raised, andWeizenbaum became an advocate for maintaininghuman dignity in a world of advancing technology.

    • benchmark 基准
    • interrogator 审问者
    • conjecture 猜测
    • eerie 诡异的
    • statement 陈述
    • psychotherapy 心理治疗
    • be subservient to 屈从于
    • in a sense 在某种意义上
    • advocate 倡导者

    在过去,图灵测试(由爱兰图灵于1950年提出)作为测量人工智能领域的进程的基准。如今,图灵测试的意义已经减弱,虽然它仍然是人工智能标志重要的一部分。图灵的提议是允许一个人,我们称其为审问者,在不被告知测试对象是否是人类或者是机器的情况下通过打字机系统与测试对象交流。在这个环境下,如果审问者不能区分它人类,机器就被宣布表现了智能。图灵渔业到2000年机器具有百分之30的机率通过五分钟的图灵测试——事实证明这个猜测出乎意料地准确。

    图灵测试不再认为是测试智能的有效测试手段的一个原因是相对容易地制造出智能的诡异外观。一个著名的例子由Joseph Weizenbaum在1960年代中期创建的DOCTOR程序产生(更普遍的系统称作ELIZA的一个版本)。这个交互式程序被设计成旨在投影杰斯分析师进行心理访谈的形象。计算机扮演分析师的角色,用户扮演病人。DOCTOR在内部做的所有都是根据一些很好定义好的规则重构病人做的陈述,再回馈给病人。例如,相应“我今天很累”这个陈述时,DOCTOR可能已经回复“为什么你今天认为累?”如果DOCTOR不能认出句子结构,它只会回复一些如“继续”或者“这非常有趣。”的话。

    Weizenbaum发展DOCTOR的目的时处理自然语言交流的研究。心理治疗的对象只提供了程序能够“交流”的环境。这让Weizenbaum很沮丧,然而,几个心理学家提出将这个程序用于实际的心理治疗中。(罗杰斯的理论是病人而不是分析学家,应该主导谈话在治疗过程中,因此他们认为一个计算机可能像治疗师一样主导一场谈话。)而且,DOCTOR强烈地投射了理解的形象以至于许多与它“交流”的人屈从于机器的问题答案对话中。在某种意义上,DOCTOR通过了图灵测试。结果是伦理和技术问题被提出,Weizenbaum成为了一位在技术不断发展的世界中维护人类尊严的倡导者。

    赞(0)
    未经允许不得转载:171主机测评 » 【day12】
    分享到: 更多 (0)

    评论 抢沙发

    • 昵称 (必填)
    • 邮箱 (必填)
    • 网址