結果

問題 No.1089 三変数方程式
ユーザー kpinkcat
提出日時 2023-08-26 19:20:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,840 ms / 2,000 ms
コード長 573 bytes
コンパイル時間 1,082 ms
コンパイル使用メモリ 99,448 KB
最終ジャッジ日時 2025-02-16 14:48:53
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
using namespace std;


int main()
{
    int n, cnt = 0;
    cin >> n;
    for (int i = 0; i <= n; i++){
        for (int j = i; j <= n; j++){
            for (int k = j; k <= n; k++){
                if (i+j+k == n){
                    if (i == j && i == k) cnt++;
                    else if (i == j || j == k) cnt += 3;
                    else cnt += 6;
                }
            }
        }
    }
    cout << cnt << endl;
}
0