在线法官犯错
Online Judge do mistake?
well正如我一直说的那样,我是一个新的C++程序员当我解决简单的问题来剃除我的技能或你们所说的任何东西时......我面对这种不断发生的奇怪事情在线法官不断给我一个错误的答案......
现在要确定我做的一切都是正确的我调试并使用了许多输入,每次我都能获得正确的输出.
现在,我将为您提供一个简单的代码,该代码给我一个错误,其中包含包含描述的链接问题。
让我们从链接开始:http://www.urionlinejudge.com.br/repository/UOJ_1036_en.html现在的代码:
#include <cmath>
#include <iomanip>
#include <iostream>
void Formula(float v1, float v2, float b);
using namespace std;
int main(int argc, char **argv) {
//making the variables ....
float a, b, c;
float v1, v2;
//reading the variables
cin >> a >> b >> c;
//assign v1,v2
v1 = (pow(b, 2) - (4 * a * c));
v2 = 2 * a;
//making sure that i can use V1 , V2
if (v1 < 0 || v2 == 0) {
cout << "Impossivel calcular" << endl;
} //end of the if condition .....
else {
//at this condition i will call a function that calculate the square root(s)
Formula(v1, v2, b);
} //end of the else condition
return 0;
} //end of the main method.....
//////////////////////////
//////////////////////////
//////////////////////////
//making the methods
void Formula(float v1, float v2, float b) {
//first square root...
float result = -b + sqrt(v1);
result /= v2;
cout << "R1 = " << fixed << setprecision(5) << result << endl;
//second square root ...
result = -b - sqrt(v1);
result /= v2;
cout << "R1 = " << fixed << setprecision(5) << result << endl;
} //end of the method .....
好吧,这是最简单的例子...现在这可能是我的错误,因为我是 C/C++ 的新手如果有什么问题,请告诉我,在大多数情况下,我应该尝试的最佳输入是什么?
void Formula(float v1, float v2, float b) {
//first square root...
float result = -b + sqrt(v1);
result /= v2;
cout << "R1 = " << fixed << setprecision(5) << result << endl;
//second square root ...
result = -b - sqrt(v1);
result /= v2;
cout << "R1 = " << fixed << setprecision(5) << result << endl;
} //end of the method .....
将第 2 R1 =
修改为 R2 =
。
相关文章:
- #定义c-预处理器常量..我做错了什么
- 努力将整数转换为链表。不知道我在这里做错了什么
- 首要问题的答案让值班员搞错了
- 在线编译器中的分段C++没有打印消息
- Windows/Cygwin - 不能使用 pybind11 - 犯错误
- 看起来is_nothrow_constructible_v()在MSVC中被破坏了,我错了吗
- .h 和.cpp文件分离时出错,但仅使用 .h 文件时没有错误.我做错了什么?
- 我的C++线程做错了什么?
- 如何正确使用 >=?(a+f()+c)>=0 错了吗?
- 为什么这段代码给我错误? 有没有自错?
- 在线程之间拆分任务总是值得的吗?
- join() 失败,如果在线程内部调用 io_context.run()
- 谁能告诉我我用 getline 做错了什么 (cpp) 格式
- 如何在C++中在线组装?
- 混合std :: wcout and std :: cout会犯错,什么错
- SystemC犯错:键入不匹配成员分配
- 下次使用该函数将犯错
- 字符串订阅超出范围 - 我在哪里犯错
- 在线法官犯错
- 在线评委答错