D. 【Level 0】条件判断

    Type: Default 1000ms 256MiB

【Level 0】条件判断

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Description

  我们在编写程序时,往往需要条件判断来执行不同的代码,条件判断的格式如下

if (exp) {
    // do something...
}
else {
    // do something...
}

  其含义为,当exp为真时,执行if花括号内容,否则执行else花括号内容,例如下面代码的输出为5 >= 3

if (5 < 3) {
    cout << "5 < 3" << endl;
}
else {
    cout << "5 >= 3" << endl;
}

  exp的值为true或者false,分别表示真/假。我们也可以用bool类型来存储一个表达式的真假,例如

int a = 5, b = 3;
bool check = a > b;

if (check) {
    cout << "a > b" << endl;
}
else {
    cout << "a <= b" << endl;
}

  对于一个bool表达式,我们可以用!来反转它的结果,例如

int a = 5, b = 3;
bool check = a > b;
if (!(5 > 3)) {
    cout << "5 <= 3" << endl;
}

if (!check) {
    cout << "a <= b" << endl;
}

  此外,我们有时候会见到if - else if - else的写法,其实只是省略了花括号,本质上还是在else里面有一个if-else结构,例如

if (a > b) {

}
else {
    if (a == b) {

    }
    else {

    }
}

等价于

if (a > b) {
}
else if (a == b) {
}
else {
}

Format

Input

  输入三个浮点数,100a,b,c100-100 \leq a, b, c \leq 100

Output

  判断方程 ax2+bx+c=0ax^2 +bx + c=0 是否有解,有解输出yes,无解输出no

Samples

1 2 3
no
10 34.5 16.6
yes

C++入门

Not Attended
Status
Done
Rule
IOI
Problem
8
Start at
2023-12-14 0:00
End at
2024-1-24 16:00
Duration
1000 hour(s)
Host
Partic.
24