ZJANS

d511. 小明的作業

Easy Last Update: 2026/01/22
數學

給三個數 a, b, c,代表三邊長
判斷 a, b, c 能否組成三角形


解法一

✅ 完整代碼

評分結果(參考) : AC (1ms, 344KB)

#include<bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int score = 0;
    vector<int> edge(3);
    while(cin >> edge[0] >> edge[1] >> edge[2]){
        sort(edge.begin(), edge.end());
        
        if(edge[0]+edge[1] > edge[2]){
            score++;
        }
    }
    cout << score;
    
    return 0;
}