0
点赞
收藏
分享

微信扫一扫

codeforces 214A System of Equations

1kesou 2022-09-07 阅读 60


A. System of Equations



time limit per test



memory limit per test



input



output



Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immediately. Can you?

You are given a system of equations:



codeforces 214A System of Equations_暴力


(a, b) (0 ≤ a, b)



Input



n, m (1 ≤ n, m ≤ 1000)



Output



On a single line print the answer to the problem.



Examples



input



9 3



output



1



input



14 28



output



1



input



4 20



output



0



Note



(3, 0). In the second sample the suitable pair is integers (3, 5). In the third sample there is no suitable pair.



水题

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
using namespace std;
int main()
{
int n,m,s=0;
cin>>n>>m;
for(int i=0;i<=1000;i++)
{
for(int j=0;j<=1000;j++)
{
if(i*i+j==n&&i+j*j==m)
s++;
}
}
cout<<s<<endl;
return 0;
}




举报

相关推荐

0 条评论