【day29】

题目:

大家都知道,手机号是一个11位长的数字串,同时,作为学生,还可以申请加入校园网,如果加入成功,你将另外拥有一个短号。假设所有的短号都是"6"+手机号的后5位,比如号码为13512345678的手机,对应的短号就是645678。

现在,如果给你一个11位长的手机号码,你能找出对应的短号吗?

cpp 复制代码
#include<iostream>
#include<string>
using namespace std;
int main() {
	int n;
	cin >> n;
	while (n > 0) {
		n--;
		string a;
		cin >> a;
		cout << 6;
		for (int i = 6; i < 11; i++) {
			cout << a[i];
		}
		cout << endl;
	}
	return 0;
}

题目:

对于给定的一个字符串,统计其中小写字母出现的次数。

cpp 复制代码
#include<iostream>
#include<string>
using namespace std;
int main() {
	int n;
	cin >> n;
	while (n > 0) {
		n--;
		string a;
		cin >> a;
		int cnt = 0;
		for (char c : a) {
			if (c >= 'a' && c <= 'z') {
				cnt++;
			}
		}
		cout << cnt << endl;
	}
	return 0;
}

题目:

你的弟弟刚做完了"100以内数的加减法"这部分的作业,请你帮他检查一下。每道题目(包括弟弟的答案)的格式为a+b=c或者a-b=c,其中a和b是作业中给出的,均为不超过100的非负整数;c是弟弟算出的答案,可能是不超过200的非负整数,也可能是单个字符"?",表示他不会算。

cpp 复制代码
#include<iostream>
#include<string>
using namespace std;

bool judge(string a) {//a+b=c
	int k = 0;
	int j = 0;
	int op = -1, ans = 0, o = 0;
	for (char c : a) {
		if (c<='9'&&c>='0') {
			if (op == -1)k = (int)(c - 48) + k * 10;//a
			if (op >= 0 && op < 3)j = (int)(c - 48) + j * 10;//b
			if (c == '?')return false;
			if (op == 3)o = (int)(c - 48) + o * 10;//c		
		}
		else if (c == '+') {
			op = 0;
		}
		else if (c == '-') {
			op = 1;
		}
		else if (c == '=') {
			if (op) {
				ans = k - j;
			}
			else ans = k + j;
			op = 3;
		}
	}
	return o == ans ? true : false;
}
int main() {

	int cnt = 0;
	string a;
	while (getline(cin, a)) {
		if (a.empty())break;//输入是空行则退出循环
		if (judge(a))cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Translation:

Analogue computers began to be built in the late 19th century.Early models calculated by means of rotating shafts and gears.Numerical approximations of equations too difficult to solve in any other way were evaluated with such machines. Lord Kelvin built a mechanical tide predictor that was a specialized analoguecomputer. During World Wars I and II, mechanical and, later,electrical analogue computing systems were used as torpedocourse predictors in submarines and as bombsight controllers in aircraft. Another system was designed to predict spring floodsin the Mississippi River basin.

模拟计算机创建于19世纪末。早期的模型通过旋转轴和齿轮来运算。很难用其他方法解出方程数值近似值,这问题可以用这计算机计算。 Lord Kelvin建造了一个机械潮汐预测器,它是一台特制的模拟计算机。在第一、二次世界大战期间,机械和之后的电力模拟计算机系统被用作鱼雷航向预测器来检测潜水艇,以及作为飞机上的轰炸瞄准器控制器。另一个系统被设计旨在预测密西西比河流域的春季洪水。

  • Analogue computers 模拟计算机
  • approximation 近似值
  • torpedocourse 鱼雷航向预测器
  • bombsight controllers 轰炸瞄准器控制器

During World War II, a team of scientists and mathematicians,working at Bletchley Park, north of London, created one of thefirst all-electronic digital computers: Colossus . By December1943, Colossus, which incorporated 1,500 vacuum tubes, was operational. It was used by the team headed by Alan Turing ,in the largely successful attempt to crack German radio messages enciphered in the Enigma code .

在第二次世界大战期间,由工作在伦敦北部布莱切利园的科学家和数学家组成的队伍创建了第一台全电力数字计算机之一:巨人计算机。到1943年12月,巨人计算机,包含1500个真空管,运行起来了。由爱兰图灵带领的团队使用它,极大成功地尝试破解了用恩尼格玛密码加密的德国电报。

  • vacuum tube 真空管
  • crack 打破,破解
  • encipher 加密

Independently of this, in the United States, a prototype electronic machine had been built as early as 1939, by JohnAtanasoff and Clifford Berry at Iowa State College. Thisprototype and later research were completed quietly and later overshadowed by the development of the Electronic Numerical Integrator And Computer (ENIAC) in 1945. ENIAC was granted a patent, which was overturned decades later, in 1973,when the machine was revealed to have incorporated principles first used in the Atanasoff-Berry Computer.

除了这个,在美国,一台原型店里机器同样在1939年,由在爱荷华州立学院的JohnAtanasoff和Clifford Berry创造出来。这台原型和之后的研究悄无声息地完成,之后被电子数字积分计算机在1945年的发展所掩盖。ENIAC被授予了专利,但在1973年十几年之后这项专利被推翻了,当这台机器被揭露包含了第一次被用于 Atanasoff-Berry计算机的原理。

  • integrator 积分

相关推荐
MoonOutCloudBack1 小时前
VeRL 框架下 RL 微调 DeepSeek-7B,比较 PPO / GRPO 脚本的参数差异
人工智能·深度学习·算法·语言模型·自然语言处理
_F_y2 小时前
二叉树中的深搜
算法
锅包一切2 小时前
PART17 一维动态规划
c++·学习·算法·leetcode·动态规划·力扣·刷题
Polaris北2 小时前
第二十六天打卡
c++·算法·动态规划
Stringzhua3 小时前
队列-优先队列【Queue3】
java·数据结构·队列
罗湖老棍子4 小时前
【例 2】选课(信息学奥赛一本通- P1576)
算法·树上背包·树型动态规划
每天要多喝水4 小时前
动态规划Day33:编辑距离
算法·动态规划
每天要多喝水4 小时前
动态规划Day34:回文
算法·动态规划
weixin_477271694 小时前
马王堆帛书《周易》系统性解读(《函谷门》原创)
算法·图搜索算法