結果

問題 No.1218 Something Like a Theorem
ユーザー CELICA
提出日時 2020-09-05 07:43:15
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 633 bytes
コンパイル時間 1,891 ms
コンパイル使用メモリ 166,232 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-27 12:46:10
合計ジャッジ時間 2,747 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ul = unsigned long;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int n, z;
	cin >> n >> z;

	string res{ "No" };
	if (n == 1)
    {
		cout << (z > 1 ? "Yes" : "No") << "\n";
        //return 0;
    }
	else if (n == 2)
	{
		for (int i = 1; i < z; ++i)
		{
			for (int j = 1; j < z; ++j)
			{
				if (i * i + j * j == z * z)
                {
					cout << "Yes" << "\n";
                    return 0;
                }
			}
		}
		cout << "No" << "\n";
        //return 0;
	}
    else
    {
        cout << "No" << "\n";
    }

	return 0;
}
0