Y/N
来源:互联网 发布:智能机器人编程入门 编辑:程序博客网 时间:2024/06/08 20:07
Description
有如下四个式子: X+Y=A X^2+Y^2=B X^3+Y^3=C X^4+Y^4=D给出A、B、C、D四个值,你能判断A、B、C、D这四个值能同时让上面四个式子成立吗?
Input
有多组测试数据。每组中都输入四个整数,分别是A、B、C、D。0<=A,B,C,D<=50
Output
如果这四个值能同时让上面四个式子成立,输出“Y”,否则输出“N”。 每组输出数据占一行。
Sample Input
1 3 4 5
Sample Output
N
#include<iostream>
using namespace std;
int sq(int a)
{
returna*a;
}
int main()
{
int a , b , c , d;
while (cin >>a>> b >>c >> d)
{
if ( (3*b-sq(a)) * a == 2*c && 2*sq(b) - sq(sq(a)-b) == 2*d)
cout<<"Y"<< endl;
else
cout <<"N"<< endl;
}
}
0 0
- Y/N
- Y/N
- bat Y/N?
- Y/N退出选择训练
- SDUT 1447 水题(y*y = x*x + n)
- obj-m ,obj-y,obj-n
- Display all 2165 possibilities? (y or n)
- 利用循环实现Y/N多次选择
- x^n+y^n求解(xdoj 1115)
- bzoj 4152 the camptin (dis[x][y]=min(|x.x-y.x|,|x.y-y.y|),求1,n最短路)
- y
- y
- Y
- Y
- Y
- Y
- y
- Y
- Software Bugs
- taskDelay的offset范围
- 回文数
- 转载:DigitalOcean使用小记
- A Simple Math Problem
- Y/N
- above average
- Next K-Bit Number<T…
- Polynomial Integration<Cont…
- 江鸟的困惑
- 子字符串寻址
- Message Decowding
- Internet
- 杭电acm2004成绩转换