三角形的判定
算法分析:
简单数学题,三角形两边之和大于第三边
#include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(false);
int a, b, c;
cin >> a >> b >> c;
if (a + b > c && b + c > a && a + c > b)
cout << "Valid";
else
cout << "Invalid";
return 0;
}
星号三角阵(一)
算法分析:
找规律,每行的*都是以1递增的
#include <iostream>
using namespace std;
int n;
int main() {
ios::sync_with_stdio(false);
cin >> n;
for(int i = 1; i <= n ; ++i) {
for (int j = 1; j <= i;