1.28复试训练
在某些情况下,随着智能体的不断学习,他们的反应会得到改善。然而,通过分离各种类型的理性行为并独立地对其进行研究,研究人员获得了一个立足点,之后可以将其与其他领域的进展相结合,以产生更智能的智能体。对每组测试数据,你的程序需要向标准输出设备(通常为启动该程序的文本终端)输出两行,每行包括3个整数,第一行为最晚日期,第二行为最早日期,整数之间以一个空格分隔,行首与行尾无空格,所有数据前后没有多余的空行
题目:1.水果价格
问题描述
一家水果店出售四种水果,每公斤价格的苹果(代码为a)1.5元,橘子(代码为o)1.4元,香蕉(代码为b)1.48元,菠萝(代码为p)1.08元。编一个程序,使售货员只要在键盘上打入货品的代码及重量,计算机将显示货品名、单价、重量及总价。
输入说明
你的程序需要从标准输入设备(通常为键盘)中读入多组测试数据。
每组测试数据的第一行为一个整数m,表示有m件货品要被购买。在接下来的m行中,每行输入两个值d,g。d表示货品的代码,g表示重量。两组数据之间没有多余的空行。
输出说明
对每组测试数据,你的程序需要向标准输出设备(通常为启动该程序的终端)依次输出一组对应的答案。对应每组输入,输出货品名、单个总价及全部总价。具体格式参照样例输出:第一行apple前为7个空格,之后为2个空格,其他水果名后都是1个空格,sum后没有空格;第二行price后有2个空格,其后关于价格的表示多为占7格2位小数且左对齐,但其中pineapple为占10格2位小数且左对齐,注意sum的价格仍然占7格,如第一组样例中的54.60后还有2个空格;第三行weight后有1个空格,其后的数据与第二行一致。每两组数据之间有一个空行,最后一组测试数据之后没有空行。
输入范例
4
a 10
o 10
b 10
p 10
2
a 5.7
a 3.8
输出范例
apple orange banana pineapple sum
price 15.00 14.00 14.80 10.80 54.60
weight 10.00 10.00 10.00 10.00 40.00
apple orange banana pineapple sum
price 14.25 0.00 0.00 0.00 14.25
weight 9.50 0.00 0.00 0.00 9.50
个人总结:
1.这道题最重要的是格式printf("price %-7.2)表示占七格的两位小数。
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
int first_case = 1;
while(cin>>n){
if (!first_case) {
printf("\n"); // 组间空行
}
first_case = 0;
double a[6]={0.00};
double b[6]={0.00};
char t;
double num;
for(int i=1;i<=n;i++){
cin>>t;
cin>>num;
if(t=='a') {
a[1]+=num*1.5;
b[1]+=num;
b[5]+=num;
a[5]+=num*1.5;
}else if(t=='o'){
a[2]+=num*1.4;
b[2]+=num;
b[5]+=num;
a[5]+=num*1.4;
}else if(t=='b'){
a[3]+=num*1.48;
b[3]+=num;
b[5]+=num;
a[5]+=num*1.48;
}else if(t=='p'){
a[4]+=num*1.08;
b[4]+=num;
b[5]+=num;
a[5]+=num*1.08;
}
}
printf(" apple orange banana pineapple sum\n");
printf("price %-7.2f%-7.2f%-7.2f%-10.2f%-7.2f\n",
a[1], a[2], a[3], a[4],a[5]);
printf("weight %-7.2f%-7.2f%-7.2f%-10.2f%-7.2f\n",
b[1], b[2], b[3], b[4], b[5]);
}
}
题目:2.求奇数的乘积
问题描述
给你n个整数,求他们中所有奇数的乘积。
输入说明
输入数据包含两行,第一行为一个数为n,表示第二行将输入n个整数。你可以假设这n个数据中必定至少存在一个奇数。
输出说明
输出一个整数。
输入范例
5
3 0 4 6 5
输出范例
15
个人总结:
1.这道题要注意排除0;
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
int num=1;
cin>>n;
for(int i=1;i<=n;i++){
int j;
cin>>j;
if(j%2!=0&&j!=0){
num*=j;
}
}
cout<<num;
}
题目:3.求最晚和最早日期
问题描述
输入N个日期,每个以年、月、日的顺序读入,打印输出最晚的日期、最早的日期。
输入说明
你的程序需要从标准输入设备(通常为键盘)中读入多组测试数据。每组输入数据由多行组成。每组测试数据的第一行输入一个整数N(0<N<20),表示有N个日期。其后N行每行有三个整数Y(1≤Y≤2015),M(1≤M≤12),D(1≤D≤31)表示一个日期。
输出说明
对每组测试数据,你的程序需要向标准输出设备(通常为启动该程序的文本终端)输出两行,每行包括3个整数,第一行为最晚日期,第二行为最早日期,整数之间以一个空格分隔,行首与行尾无空格,所有数据前后没有多余的空行,两组数据之间也没有多余的空行。
输入范例
3
2015 3 2
2011 4 15
1 1 1
输出范例
2015 3 2
1 1 1
个人总结:
1.这道题需要注意条件的并和与。
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
int ny,nm,nd,ly,lm,ld;
cin>>n;
for(int i=1;i<=n;i++){
int y,m,d;
cin>>y>>m>>d;
if(i==1){
ny=y;nm=m;nd=d;
ly=y;lm=m;ld=d;
}
if((y<ny)||(y==ny&&m<nm)||(y==ny&&m==nm&&d<nd)){
ny=y;nm=m;nd=d;
}
if((y>ly)||(y==ly&&m>lm)||(y==ly&&m==lm&&d>ld)){
ly=y;lm=m;ld=d;
}
}
cout<<ly<<" "<<lm<<" "<<ld<<endl;
cout<<ny<<" "<<nm<<" "<<nd;
}
英语翻译
In some cases an agent's responses improve over time as the agent learns. This could take the form of developing procedural knowledge(learning "how") or storing declarative knowledge (learning"what"). Learning procedural knowledge usually involves a trial-and-error process by which an agent learns appropriate actions by being punished for poor actions and rewarded for good ones. Following this approach, agents have been developed that, over time, improve their abilities in competitive games such as checkers and chess. Learning declarative knowledge usually takes the form of expanding or altering the "facts" in an agent's store of knowledge. For example, a baseball player must repeatedly adjust his or her database of knowledge from which rational responses to future events are determined.
在某些情况下,随着智能体的不断学习,他们的反应会得到改善。这可能表现为程序性知识的发展(学习如何做)或者陈述性知识的存储(学习是什么)。程序性知识学习通常涉及一个反复试验的过程,通过对他们错误的行为惩罚对好的行为奖励。遵循这种方法已经开发出一些智能体,它们在诸如跳棋和国际象棋等竞争性游戏中随着时间提升了自己的能力。陈述性知识的学习通常表现为扩展或改变智能体知识库中的事实。例如,棒球运动员必须反复调整他的知识库以便为未来的事情作出合理反应。
To produce rational responses to stimuli, an agent must
"understand" the stimuli received by its sensors. That is, an agent must be able to extract information from the data produced by its sensors, or in other words, an agent must be able to perceive.
In some cases this is a straightforward process. Signals obtained from a gyroscope are easily encoded in forms compatible with calculations for determining responses.But in other cases
extracting information from input data is difficult. Examples include understanding speech and images. Likewise, agents must be able to formulate their responses in terms compatible with their actuators. This might be a straightforward process or it might require an agent to formulate responses as complete spoken sentences-meaning that the agent must generate speech. In turn, such topics as image processing and analysis, natural language understanding, and speech generation are important areas of research.
为了对刺激产生合理的反应,一个智能体必须通过他的感受器理解刺激。这意味着一个智能体必须能够从它感受器创造的数据里提取信息,换句话说,智能体必须能够感知。在某些情况下,这是一个很简单直接的过程。从陀螺仪获得的信号很容易以与计算确定反应相兼容的形式进行编码。但在其他情况下,从输入的数据提取信息是很难的。例如理解语音和图像。同样,智能体必须能够以与其执行器兼容的形式制定其反应。这可能是一个简单的过程,也可能需要智能体将反应制定为完整的口语句子。反过来,诸如图像处理和分析,自然语言理解以及语音生成等主题是重要的研究领域。
The agent attributes that we have identified here represent past as well as current areas of research. Of course, they are not totally independent of each other. We would like to develop agents that possess all of them, producing agents that understand the data received from their environments and develop new response patterns through a learning process whose goal is to maximize the agent's abilities. However, by isolating various types of rational behavior and pursuing them independently, researchers gain a toehold that can later be combined with progress in other areas to produce more intelligent agents.
我们在此所确定的这些智能体特征涵盖了过去以及当前的研究领域。当然,它们并非完全相互独立。我们希望开发出具备所有这些特性的智能体,创造出能够理解来自其环境的数据,并通过一个旨在最大限度提升智能体能力的学习过程来形成新反应模式的智能体。然而,通过分离各种类型的理性行为并独立地对其进行研究,研究人员获得了一个立足点,之后可以将其与其他领域的进展相结合,以产生更智能的智能体。
更多推荐



所有评论(0)