結果
| 問題 | No.1218 Something Like a Theorem |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-09 18:15:52 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 350 bytes |
| 記録 | |
| コンパイル時間 | 520 ms |
| コンパイル使用メモリ | 64,628 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-15 23:57:44 |
| 合計ジャッジ時間 | 1,341 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 16 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | main()
| ^~~~
ソースコード
#include<iostream>
using namespace std;
int N,Z;
bool iss[1<<20];
main()
{
cin>>N>>Z;
if(N==1)
{
cout<<(Z==1?"No":"Yes")<<endl;
}
else if(N==2)
{
Z*=Z;
for(int i=1;i*i<=Z;i++)iss[i*i]=true;
for(int x=1;x*x<=Z;x++)
{
if(iss[Z-x*x])
{
cout<<"Yes"<<endl;
return 0;
}
}
cout<<"No"<<endl;
}
else cout<<"No"<<endl;
}