“两边之和大于第三边”是三角形的一个基本性质,有了这个,我们就可以作出这道题。 C++复制#include <bits/stdc++.h> using namespace std; int main(){ int x,y; cin>>x>>y; cout<<y-x+1<<" ";//y为长边 cout<<x+y-1;//x,y均为短边 return 0; }