我如何只用基础知识来做到这一点

我如何只用基础知识来做到这一点

本文介绍了我如何只用基础知识来做到这一点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 等式正确形式:任何操作都应该首先将每个等式转换为正确形式的 。等式本身应具有以下属性 1.变量按字母顺序从左到右排序 3x2 + 2x1 + 4x3 = 16 应该是 2x1 + 3x2 + 4x3 = 16 2.任何变量应该只出现一次 4x1 + 3x2-2x1 + 4x3 = 16 应该是 2x1 + 3x2 + 4x3 = 16 3.等式中只应出现一个常数项,它应该是 在右侧 2x1 + 3x2 + 5 + 4x3-11 = 10 应该是 2x1 + 3x2 + 4x3 = 16 第2页,共10页 4.等于1时的系数或-1数字1是可选的 1x1 + 3x2-1x3 = 10 可以输入为 x1 + 3x2-x3 = 10 我尝试了什么: 我从第一点开始,将方程式分成另一个数组,但是我被卡住了我不知道该怎么办...任何帮助? 这是我尝试过的事情 PS我' m不允许使用复杂的方法或任何STL,只是数组,字符串,向量....任何基本的:/Equation proper form : Any operation should first convert every equation tothe proper form. The equation proper should have the following properties1. variables are ordered alphabetically from left to right3x2+2x1+4x3=16Should be2x1+3x2+4x3=162. Any variable should appears only one time4x1+3x2-2x1+4x3=16Should be2x1+3x2+4x3=163. Only one constant term should appear in the equation and it should beon the right hand side2x1+3x2+5+4x3-11=10Should be2x1+3x2+4x3=16Page 2 of 104. Coefficient when equals to one or -1 the digit 1 is optional1x1+3x2-1x3=10Can be input as bex1+3x2-x3=10What I have tried:I'm starting from the first point and splitting the equation and putting it into another array but I'm stuck and I don't know what should I do ... any help??Here is what I have triedPS I'm not allowed to use complex method or any STLs, just arrays, strings, vectors.... anything basic :/cin >> s;for (int i = 0; i<s.size(); i++){if (s[i] == '+'){copyy[a] += s[i];a++;}else{copyy[a] += s[i];}}推荐答案你的任务是等式,所以你必须找到所有x实例并将它们预先排序为一种子数组。这个子目标你必须评估,然后在最后重新构建解决方案。 这是令牌x1,x2等的一些字符串操作...... 我想有些人不明白你的意思是x * x和x2; - )Your task is sort the equation, so you must find all x instances and pre-order them into an sub array of one kind. This subarry you must evaluate and than re-build the solution at end.It is some string operations for the tokens "x1", "x2" and so on...I guess some people dont understand that you mean "x*x" with "x2" ;-) 这篇关于我如何只用基础知识来做到这一点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-28 07:15