【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 积分

相关推荐
小O的算法实验室4 小时前
IEEE TASE,基于MPC的多无人机协同搜索竞争群体优化方法
算法
小飞学编程...4 小时前
【哈希表】
数据结构·哈希算法·散列表
码匠许师傅4 小时前
【C++ 面试真题】26. 聊聊 C++ 的智能指针
java·c++·面试
Tbisnic5 小时前
BGE-M3 算法详解:从模型架构到三种检索方式的数学原理
算法·自然语言处理·大模型·bert·transformer·注意力机制
Brilliantwxx5 小时前
【算法从零到千】【55-58】哈希位图+常见数学运算 接口
算法
空堂与归6 小时前
用户分群找不到规律?用K-Means聚类算法自动发现数据模式
算法·机器学习·kmeans·聚类
动词ing7 小时前
【C语言】自定义函数+指针入门
c语言·开发语言·算法
重生之后端学习7 小时前
283. 移动零[简单]✅
开发语言·数据结构·算法·leetcode·职场和发展
一只小小的芙厨8 小时前
基础数论总结
笔记·学习·算法
动词ing8 小时前
【C语言】结构体+文件基础
c语言·开发语言·数据结构