【day57】

给定两个仅由大写字母或小写字母组成的字符串(长度介于1到10之间),它们之间的关系是以下4种情况之一:

1:两个字符串长度不等。比如 Beijing 和 Hebei

2:两个字符串不仅长度相等,而且相应位置上的字符完全一致(区分大小写),比如 Beijing 和 Beijing

3:两个字符串长度相等,相应位置上的字符仅在不区分大小写的前提下才能达到完全一致(也就是说,它并不满足情况2)。比如 beijing 和 BEIjing

4:两个字符串长度相等,但是即使是不区分大小写也不能使这两个字符串一致。比如 Beijing 和 Nanjing

编程判断输入的两个字符串之间的关系属于这四类中的哪一类,给出所属的类的编号。

cpp 复制代码
#include<iostream>
using namespace std;
int main() {
	string a, b;
	cin >> a >> b;
	int lena = a.size();
	int lenb = b.size();
	int cur = 2;
	if (lena != lenb) {
		cout << 1 << endl;
		return 0;
	}
	int gap = 'a' - 'A';
	for (int i = 0; i < lena; i++) {
		if (a[i] == b[i])continue;
		if (a[i] == b[i] + gap || a[i] + gap == b[i]) {
			cur = 3;
		}
		else {
			cur = 4;
			break;
		}
	}
	cout << cur << endl;
	return 0;
}

Reinforcement learning is a machine learning approach that learns optimal strategies through interaction with the environment. In the reinforcement learning framework, an agent observes the state of the environment and takes corresponding actions in order to receive rewards or penalties. The goal of the agent is to find a policy that maximizes long-term cumulative rewards through continuous exploration and learning. Unlike supervised learning, reinforcement learning usually does not rely on large amounts of labeled data but improves decision-making ability through trial and error. Reinforcement learning has achieved success in many complex tasks such as robotic control, autonomous driving, and game artificial intelligence. In the famous Go program AlphaGo, reinforcement learning was combined with deep neural networks, enabling computers to reach or even surpass the level of top human players. However, in practical applications, reinforcement learning still faces challenges such as low sample efficiency and high training costs.

强化学习是机器学习的一个方法,他通过与环境交互来学习最优策略。在强化学习框架中,智能体观察环境情况,做出相应的行为来得到奖励或惩罚。智能体的目标是找到能够最大化长期积累奖励的策略,通过连续的探索和学习。与监督学习不同强化学习通常不依赖大量的已标签数据,但他是通过尝试和误差来提升决策制定能力。强化学习在许多复杂的任务上取得了成功,例如机器人控制自动驾驶以及游戏人工智能。在著名的go程序Alpha go中,强化学习与生存神经网络相结合,让电脑能够达到甚至超过顶尖人类玩家的水平。然而,在实际应用当中强化学习仍然面临着例如样本效率和高训练成本的挑战。


相关推荐
.5489 小时前
Two Pointers(双指针)
java·数据结构·算法
li1670902709 小时前
第二十五章:C++11(下)
c语言·开发语言·数据结构·c++
sali-tec9 小时前
C# 基于OpenCv的视觉工作流-章58-相机标定
图像处理·人工智能·数码相机·opencv·算法·计算机视觉
承渊政道9 小时前
【动态规划算法】(回文串问题解题框架与经典案例)
数据结构·c++·学习·算法·leetcode·动态规划·哈希算法
lsx2024069 小时前
DOM 改变节点
开发语言
一水鉴天9 小时前
同构异质三表总装体系确立与入表机制闭环验证 20260502(腾讯元宝)
人工智能·算法·机器学习
AI进化营-智能译站9 小时前
ROS2 C++开发系列11-VS Code一键生成Doxygen注释|让ROS2节点文档自动跟上代码迭代
java·数据库·c++·ai
时空系9 小时前
第8篇:结构模板——自定义数据类型 Rust中文编程
开发语言·网络·rust
qyzm9 小时前
Codeforces Round 1073 (Div. 2)
数据结构·python·算法
yuweiade9 小时前
GO 快速升级Go版本
开发语言·redis·golang