HUdson2092整数解
2019-05-17
16:04:37
加油,坚持就是胜利,fightting
m / i的情况,i可能等于0
#include <bits/stdc++.h> using namespace std; int main() { int n,m; while(~scanf("%d %d", &n, &m)) { if( n == 0 && m == 0) { break; } int flat = 0; for (int i = min(m, -m); i <= max(m, -m); i++) { if (i == 0) { continue; } if ((double)m / i + i == n) { cout << "Yes" << endl; flat = 1; break; } } if (flat == 0) { cout << "No" << endl; } } return 0; }