东华复试OJ二刷复盘6

进阶6:兔子的速度v1(表示每秒兔子能跑v1米),乌龟的速度v2,以及赛道的长度l,一旦任一秒结束后兔子发现自己领先t米或以上,它们就会停下来休息s秒。

cpp 复制代码
#include <bits/stdc++.h>
using namespace std;

int main(){
	int v1,v2,t,s,l;
	cin>>v1>>v2>>t>>s>>l;
	
	int time=0;
	int l1=0,l2=0;
	while(l1<l&&l2<l){
		time++;l1 = l1+v1;l2 = l2+v2;
		if(l1>=l||l2>=l)break;
		if(l1-l2 >= t){
			int tempT= s;
			while(tempT-->0){
				time+=1;l2 = l2 + v2;
				if(l2>=l)break;
			}
		}
	}
	if(l2>l1)cout<<'T'<<endl;
	if(l2==l1)cout<<'D'<<endl;
	if(l2<l1)cout<<'R'<<endl;
	cout<<time<<endl;
	system("pause");
} 

题77:写一个程序来找出将原始图案按照以下列转换方法转换成新图案的最小方式,如果有多种可用的转换方法,请选择序号最小的那个。

#1:转90度:图案按顺时针转90度。

#2:转180度:图案按顺时针转180度。

#3:转270度:图案按顺时针转270度。

#4:反射:图案在水平方向翻转(形成原图案的镜像)。

#5:组合:图案在水平方向翻转,然后按照#1-#3之一转换。

#6:不改变:原图案不改变。

#7:无效转换:无法用以上方法得到新图案。

cpp 复制代码
void Fun1(vector<vector<char>>& m,vector<vector<char>> matrix,vector<vector<char>> &target){
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			m[j][n-1-i] = matrix[i][j];
		}
	}
}

bool Fun2(vector<vector<char>> &m,vector<vector<char>> matrix,vector<vector<char>> &target){
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			m[n-1-i][n-1-j] = matrix[i][j];
		}
	}
}

bool Fun3(vector<vector<char>> &m,vector<vector<char>> matrix,vector<vector<char>> &target){
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			m[n-1-j][n-1-i] = matrix[i][j];
		}
	}
}

bool Fun4(vector<vector<char>> &m,vector<vector<char>> matrix,vector<vector<char>> &target){
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			m[i][n-1-j] = matrix[i][j];
		}
	}
}
  • 二刷,做得很慢,找原矩阵的转化映射规律。

题80:饲料调配,给出目标饲料和三组整数,表示 大麦:燕麦:小麦 的比例,找出用这三种饲料调配目标饲料的方法。

cpp 复制代码
#include <bits/stdc++.h>
using namespace std;

int main(){
	int TargetX,TargetY,TargetZ;
	cin>>TargetX>>TargetY>>TargetZ;
	vector<vector<int>> matrix(3,vector<int>(3,0));
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++)cin>>matrix[i][j];
	}
	
	//------------------------------------------
	for(int i=0;i<100;i++){
		for(int j=0;j<100;j++){
			for(int k=0;k<100;k++){
				int numA=i*matrix[0][0]+
				j*matrix[1][0]+k*matrix[2][0];
				
				int numB=i*matrix[0][1]+
				j*matrix[1][1]+k*matrix[2][1];
				
				int numC=i*matrix[0][2]+
				j*matrix[1][2]+k*matrix[2][2];
				int xishu;
				if(TargetX!=0)xishu=numA/TargetX;
				else if(TargetY!=0)xishu=numB/TargetY;
				if(xishu*TargetX==numA&&xishu*TargetY==numB&&xishu*TargetZ==numC){
					if(i==0&&j==0&&k==0)continue;
					cout<<i<<' '<<j<<' '<<k<<' '<<xishu<<endl;
					system("pause");return 0;
				}
			}
		}
	}
	cout<<"NONE";
}
  • 越界异常之一为除0,且测试案例可能为0,对测试输入要考虑最小值和最大值并在编写时注意该边界情况。

Neural machine translation has recently shown impressive results (Kalchbrenner and Blunsom, 2013; Sutskever et al., 2014; Bahdanau et al., 2015). However, the translation of rare words is an open problem. The vocabulary of neu ral models is typically limited to 30000--50000 words, but translation is an open-vocabulary problem, and especially for languages with produc tive word formation processes such as aggluti nation and compounding, translation models re quire mechanisms that go below the word level. As an example, consider compounds such as the German Abwasser|behandlungs|anlange `sewage water treatment plant', for which a segmented, variable-length representation is intuitively more appealing than encoding the word as a fixed-length vector.

  • 神经机器翻译近来展现出惊人的结果。然而,罕见词的翻译是一个待解决的 问题。神经模型的词汇量普遍限制在三万到五万单词之间,但是翻译是一个无限词汇 问题,特别是能产性构词方式的 语言中创造性的单词规范化处理例如凝集作用黏着 和复合,翻译模型需要深入 单词级别之下的机制。比如,考虑像德语中 Abwasser|behandlungs|anlange `sewage water treatment plant' 这样的分段的复合词,采用分段的 可变长度表示显然 是比将单词编码为固定长度向量的更本能的吸引更为合理
  • open problem 待解决的难题
  • open-vocabulary problem 无限词汇问题
  • productive word formation processes 产性构词方式过程
  • go below 深入...以下
  • agglutination 黏着
  • intuitively more appealing 显然更为合理/在直觉上更具吸引力

For word-level NMT models, the translation of out-of-vocabulary words has been addressed through a back-off to a dictionary look-up (Jean et al., 2015; Luong et al., 2015b). We note that such techniques make assumptions that often do not hold true in practice. For instance, there is not al ways a 1-to-1 correspondence between source and target words because of variance in the degree of morphological synthesis between languages, like in our introductory compounding example. Also, word-level models are unable to translate or gen erate unseen words. Copying unknown words into the target text, as done by (Jean et al., 2015; Luong et al., 2015b), is a reasonable strategy for names, but morphological changes and transliteration is often required, especially if alphabets differ.

  • 对于单词级别的词级 NMT模型,词汇表之外的单词的翻译已经通过后退至词典的查找而解决。我们发现这样的技术做出了实际不对的假设做出的假设往往在实践中不成立 。比如,在源和目标单词之间不总是有一对一的关联对应 ,因为语言之间的语法的合成程度形态综合程度 差异,就像我们介绍的复合案例。同样,单词级别模型不能翻译或生成没见过的单词。将未见过的单词复制成目标文本,正如由简做得,对于专有名词 是一个合理的策略,但是通常需要进行 语法的形态 变化和通常必要的音译,特别是如果使用不同 字母表不同。
  • morphological 形态上的/语法的,synthesis 合成,introductory 介绍性的,transliteration 音译,differ 不同/相异
  • out-of-vocabulary words 集外词
  • morphological synthesis 形态综合
  • name 专有名词
  • morphological changes and transliteration is often required 其中is often required是修饰morphological changes and transliteration这两者为一个整体的。
相关推荐
网络与设备以及操作系统学习使用者16 小时前
路由器如何实现跨VLAN通信
运维·网络·学习·华为·智能路由器
182******208316 小时前
2026年学C语言还有出路吗?学习需要报班吗?
c语言·开发语言·学习
东方佑17 小时前
可学习破坏策略:实现大语言模型二倍推理加速的统一自洽框架
人工智能·学习·语言模型
森林古猿117 小时前
论CDQ分治
c++·学习·算法·排序算法
AOwhisky17 小时前
MySQL 学习笔记(第三期):SQL 语言之数据操作与单表查询
linux·运维·笔记·sql·学习·mysql·云计算
Niyy_17 小时前
Rust 学习笔记 01
笔记·学习·rust
baby_hua18 小时前
ComfyUI 工作流 模型学习笔记1
笔记·学习
xuhaoyu_cpp_java18 小时前
项目学习(一)逆向工程学习
经验分享·笔记·学习
nashane18 小时前
HarmonyOS 6学习:HAR包跨平台编译陷阱与架构优化实战
学习·华为·harmonyos
数智工坊19 小时前
周志华《Machine Learning》学习笔记--第六章--支持向量机
笔记·神经网络·学习·算法·机器学习·支持向量机