hdoj 1840 Equations
来源:互联网 发布:电力负荷计算软件 编辑:程序博客网 时间:2024/05/24 15:41
Equations
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)
Total Submission(s): 1001 Accepted Submission(s): 458
Problem Description
All the problems in this contest totally bored you. And every time you get bored you like playing with quadratic equations of the form a*X2 + b*X + c = 0. This time you are very curious to know how many real solutions an equation of this type has.
Input
The first line of input contains an integer number Q, representing the number of equations to follow. Each of the next Q lines contains 3 integer numbers, separated by blanks, a, b and c, defining an equation. The numbers are from the interval [-1000,1000].
Output
For each of the Q equations, in the order given in the input, print one line containing the number of real solutions of that equation. Print “INF” (without quotes) if the equation has an infinite number of real solutions.
Sample Input
31 0 01 0 -10 0 0
Sample Output
12INF
水题:
#include<stdio.h>#include<string.h>int main(){ int t; double a,b,c,d; scanf("%d",&t); while(t--) { scanf("%lf%lf%lf",&a,&b,&c); d=b*b-4*a*c; if(a!=0) { if(d>0) printf("2\n"); else if(d<0) printf("0\n"); else printf("1\n"); } else { if(b==0&&c==0) printf("INF\n"); else if(b==0&&c!=0) printf("0\n"); else if(b!=0&&c!=0) printf("1\n"); else printf("1\n"); } } return 0;}
0 0
- hdoj 1840 Equations
- HDOJ Equations
- HDOJ 题目1840 Equations(水,数学)
- hdoj.1840 Equations【水题】 2015/03/27
- hdoj 1496 Equations (HASH)
- HDOJ 1496: Equations 这道题也哈希。。。
- hdoj 1496 Equations
- HDOJ 1496 - Equations Hash
- HDOJ 1496 Equations hash
- hdoj-1496-Equations
- HDOJ 1840 Equations 一道初中生可以解决的题目
- ACM--方程解的个数––HDOJ 1840--Equations--水
- HDOJ 题目1496 Equations(hash)
- HDU 1840 Equations
- Equations
- Equations
- Equations
- hdoj How Many Equations Can You Find【DFS】
- java excel Workbook API
- 马尔科夫模型初探
- 浏览器开发系列第一篇:如何获取最新chromium源码
- 实体对象的变更
- vim带你装逼带你飞(一)
- hdoj 1840 Equations
- 完美解决 未能打开编辑器:Unmatched braces in the pattern.
- pysftp Exception: Expecting packet from (31,), got 94
- [ 正则 ]正则表达式进阶!
- 阴影映射(Shadow Map)的研究(一)
- 直接链接字段的添加以及substring内存泄露的考虑
- activity生命周期
- 基于java反射知识的类查看器
- Hibernate缓存机制