solution
测试点4:1 1
不符合缘分数定义,但是这个判断能够通过记得排除掉
#include<iostream>
#include<cmath>
using namespace std;
bool judge(int n){int t = sqrt(n);if(t * t == n) return true;return false;
}
int main(){int n, m, c, cc, flag = 1;scanf("%d%d", &m, &n);for(int i = m; i <= n; i++){cc = pow(i, 3) - pow(i - 1, 3);c = sqrt(cc);if(c * c == cc){for(int j = 1, k; j <= c; j++){k = c - j;if(judge(j) && judge(k) && (sqrt(j) - sqrt(k)) == 1){if(!(j == 1 && i == 1))printf("%d %d\n", i, (int)sqrt(j));flag = 0;}}}}if(flag) printf("No Solution");return 0;
}