알고리즘

[알고리즘] 백준 14568 - 2017 연세대학교 프로그래밍 경시대회 (C++)

blueberrysoda 2025. 3. 28. 23:49

[문제 링크] : https://www.acmicpc.net/problem/14568

#include <iostream> 
using namespace std;

int main(){
    int N; 
    cin >> N;

    int cnt = 0;
    for(int i=0; i<=N; i++){
        for(int j=0; j<=N; j++){
            for(int k=0; k<=N; k++){
                if(i + j + k != N || i + 2 > j || i <= 0 || j <= 0 || k <= 0 || k % 2 == 1){
                    continue;
                }
                cnt++;
            }
        }
    }

    cout << cnt << "\n";
    return 0;
}