HDU 1840--Equations【数学】【水题】
来源:互联网 发布:而知也无涯成语 编辑:程序博客网 时间:2024/04/28 21:36
Equations
Time Limit : 1000/1000ms (Java/Other) Memory Limit : 65535/65535K (Java/Other)
Total Submission(s) : 12 Accepted Submission(s) : 6
Font: Times New Roman | Verdana | Georgia
Font Size: ← →
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 <cstdio>int main (){ int t; scanf("%d",&t); while(t--){ int a,b,c; scanf("%d%d%d",&a,&b,&c); if(a!=0){ if(b*b-4*a*c>0) printf("2\n"); else if(b*b-4*a*c==0) printf("1\n"); else printf("0\n"); } else{ if(b!=0) printf("1\n"); else{ if(c==0) printf("INF\n"); else printf("0\n"); } } } return 0;}
0 0
- HDU 1840--Equations【数学】【水题】
- HDU 1840 Equations
- hdu 1496 Equations(数学:暴力|| HASH)
- HDU-4569 Special equations (数学)
- HDU 1840 Equations【简单数学题】
- HDOJ 题目1840 Equations(水,数学)
- [HDU 4569] Special equations (数学+技巧+脑洞)
- Equations HDU
- Equations(数学,水)
- Special equations(数学筛)
- hdu 1496 -- Equations(哈希)
- HDU 1496 Equations (hash)
- HDU 1496 Equations
- HDU 1496 Equations
- HDU 4569 Special equations
- hdu 1496 Equations 数论
- hdu 1496 Equations
- HDU 1496 Equations (hash)
- 网页信息抓取进阶 Jsoup的不足之处
- 【USACO3.3.3】亚瑟王的宫殿
- android:layout_weight属性分析
- Jsoup网页内容抓取分析
- C语言简单实现接口
- HDU 1840--Equations【数学】【水题】
- 怎样尊重一个程序员
- 求将来个字符数组连接起来的代码 c语言编写的
- linux下tar.gz、tar、zip等解压缩、压缩命令
- 6. 程序员生存定律--细论影响人生成绩的四个要素(1)
- 关于vhdl语言中模块连接的方法和注意点
- c++虚继承
- HDU 2178 猜数字 【二分法】
- POJ 3268 Silver Cow Party (dijkstra来回最短路)