NC52850. Simple Algebra
描述
输入描述
The input contains zero or more test cases and is terminated by end-of-file.
Each test case contains three integers a, b, c.
*
* The number of tests cases does not exceed .
输出描述
For each case, output "`Yes`" if always holds. Otherwise, output "`No`".
示例1
输入:
1 -2 1 1 -2 0 0 0 0
输出:
Yes No Yes
Python3(3.5.2) 解法, 执行用时: 82ms, 内存消耗: 3556K, 提交时间: 2019-10-05 12:47:54
while True: try: a,b,c = map(int, input().split()) if a >= 0 and c >= 0 and b*b <= 4*a*c: print("Yes") else: print("No") except EOFError: break
C++14(g++5.4) 解法, 执行用时: 22ms, 内存消耗: 484K, 提交时间: 2019-10-05 17:21:26
#include<bits/stdc++.h> using namespace std; int main() { int a,b,c; while(cin>>a>>b>>c) { if(b*b-4*a*c<=0&&a>=0&&c>=0)puts("Yes"); else puts("No"); } return 0; }
C++11(clang++ 3.9) 解法, 执行用时: 7ms, 内存消耗: 484K, 提交时间: 2020-02-25 21:29:47
#include<cstdio> int main() { int a,b,c; while(scanf("%d%d%d",&a,&b,&c)!=EOF) { if(a>=0&&c>=0&&a*c*4-b*b>=0) printf("Yes\n"); else printf("No\n"); } }