东华复试OJ二刷复盘

📅 发布时间:2026/7/14 11:18:47 👁️ 浏览次数:
东华复试OJ二刷复盘
题5银行存款有3个月、6个月定期等。从键盘输入一个日期即为存款日期以及定期的时间长度单位为月输入的时间长度可为小于等于60的任意正整数请编程输出该定期存款的到期日期。#include bits/stdc.h using namespace std; void RenewMon(int MonDay[],int year ){ if(year%40year%100!0 || year%4000){ MonDay[2-1] 29; } else{ MonDay[2-1]28; } } int main(){ int year,mon,day, bank; cinyearmondaybank; int MonDay[]{31,28,31, 30,31,30, 31,31,30 ,31,30,31}; //处理新年份和新月份 int Newmon (mon bank) ; while(Newmon12){ Newmon-12;year; } RenewMon(MonDay,year); //处理日期 if(dayMonDay[Newmon-1])day MonDay[Newmon-1]; coutyear Newmon dayendl; }粗心点没有考虑超过多个月的情况题目明确描述单位为月输入的时间长度可为小于等于60的任意正整数先读题确认数据范围和情况每次修改代码后要再读一遍代码以免遗漏未修改的变量参数。题17对于一个个位数为7的自然数N把它的个位数移到最高位其余各位均右移一位要求这样得到的一个新的数是原数的T倍。现给出这个自然数T求满足这个要求的最小的自然数N。若在[1, 1000000] 的范围内没有找到N则输出“No”。#include bits/stdc.h using namespace std; bool Check(int num,int T){ int temp num; num/10; int plus7; if(num!0){ for(int i0;ito_string(num).size();i){ plus*10; } } numplus; if(num temp * T)return true; else return false; } int main(){ int T; while(cinT){ int num7; int haveAns0; while(num1000000){ if( Check(num,T)){ coutnumendl; haveAns1; break; } num10; } if(haveAns 0)coutNoendl; } }缺少边界情况错误设置初值为17对输入1得不到正确答案。应该将输入的最小值和最大值带入检查当输入为1右移后得到的数等于原来的数除了77、还有个位数的7且“若在[1, 1000000] 的范围内没有找到N”题目给出的值域包含个位数应当考虑个位数的情况。题19给你一串数字找出在这串数字中连续出现次数最多的那个数字若有多个数字连续出现的次数相当则找出第一次出现该次数的那个数字。#include bits/stdc.h using namespace std; int main(){ int len; while(cinlen){ int ansnum-1; int anscount-1; int recordnum-1; int recordcount-1; for(int i0;ilen;i){ int temp;cintemp; if(temp!recordnum){ //错误没有考虑边界出口 ilen-1 if(recordcountanscount){ anscount recordcount; ansnum recordnum; } recordnumtemp; recordcount1; } else recordcount; if(ilen-1 ){ if(recordcountanscount){ anscount recordcount; ansnum recordnum; } recordnumtemp; recordcount1; } } coutansnum anscountendl; } }循环结构的粗心点忘记考虑最后一个值的处理和特殊事件。忘记初始化循环变量、数组越界从尾到头是i--从头到尾是i、忘记退出条件。题20给定两个正整数a、b求所有的正整数x和y使a2 x2 b2 y2其中a、b、x、y都不大于100。在所有的有效解中按x的大小进行排序从小到大输出。#include bits/stdc.h using namespace std; int main(){ int a,b; while(cinab){ if(ab b0)break; for(int x1;x100;x){ for(int y1;y100;y){ if((a*ax*x) (b*by*y)){ coutx yendl; } } } coutendl; } }同上题目说明“所有的正整数x和y”即为x、y为大于0小于等于100的整数。代码错误赋初值为0。Neural machine translation is a recently proposed approach to machine transla tion. Unlike the traditional statistical machine translation, the neural machine translation aims at building a single neural network that can be jointly tuned to maximize the translation performance. The models proposed recently for neural machine translation often belong to a family of encoder–decoders and encode a source sentence into a fixed-length vector from which a decoder generates a translation. In this paper, we conjecture that the use of a fixed-length vector is a bottleneck in improving the performance of this basic encoder–decoder architec ture, and propose to extend this by allowing a model to automatically (soft-)search for parts of a source sentence that are relevant to predicting a target word, without having to form these parts as a hard segment explicitly. With this new approach, we achieve a translation performance comparable to the existing state-of-the-art phrase-based system on the task of English-to-French translation. Furthermore, qualitative analysis reveals that the (soft-)alignments found by the model agree well with our intuition.vector 向量state-of-the-art 最先进的qualitative analysis 定性分析agree well with 结果一致/相符神经机器翻译是一个近年来提出的制造机器翻译的方法。与传统的统计学翻译不同神经机器翻译旨在建立一个单独的单一神经网络它能够共同地调制被联合调优以最大化翻译性能。最近提出的用于神经机器翻译的模型通常属于编码-解码器的家族并它们将一个源语句编码进来解码器产生翻译的一个固定长度的向量解码器再从这个向量生成翻译。在本论文中我们推测固定长度向量的使用时在对这种基础的编码解码器架构的性能改善中的瓶颈并且我们提出对此进行扩展让模型自动搜索在源语句中与预测目标单词相关的部分来延伸它而不是不得不而无需将这些部分显式地形成硬分段规范这些部分作为一个明显困难的片段。通过这一新方法我们取得了英语和法语的翻译任务上和现在最先进的基于短语的系统相媲美的表现。此外定性分析揭示了模型发现的对齐和我们的直觉是一致的。jointly tuned联合调优、协同调整vector from which a decoder generates a translationwhich指代前者vector a decoder generates a translation from vectorNeural machine translation is a newly emerging approach to machine translation, recently proposed by Kalchbrenner and Blunsom (2013), Sutskever et al. (2014) and Cho et al. (2014b). Unlike the traditional phrase-based translation system (see, e.g., Koehn et al., 2003) which consists of many small sub-components that are tuned separately, neural machine translation attempts to build and train a single, large neural network that reads a sentence and outputs a correct translation.近年来由K和B、S和C提出的神经机器翻译是新出现的机器翻译的方法。与传统的由许多小的各自调优的子组件组成的基于短语翻译系统不同后者由许多小的各自调优的子组件组成的而神经机器翻译试图建造并训练一个单一的读取一个句子并输出正确翻译的大型神经网络。Most of the proposed neural machine translation models belong to a family of encoder decoders (Sutskever et al., 2014; Cho et al., 2014a), with an encoder and a decoder for each lan guage, or involve a language-specific encoder applied to each sentence whose outputs are then compared (Hermann and Blunsom, 2014). An encoder neural network reads and encodes a source sentence into a fixed-length vector. A decoder then outputs a translation from the encoded vector. The whole encoder–decoder system, which consists of the encoder and the decoder for a language pair, is jointly trained to maximize the probability of a correct translation given a source sentence.大多数提出的神经机器翻译模型属于编码-解码器家族带有用于为每个语言配备一个编码和一个解码器或与特定语言相关的编码器用于每个输出的相比较的句子然后对它们的输出进行比较。一个编码器神经网络读取并将源语句编码成固定长度的向量。然后解码器从编码的向量中输出一个翻译。整个编码-解码系统由针对某一语言对的编码器和解码器组成每个语言对共同训练来最大化在给定源语句的正确翻译的正确率。