結果

問題 No.983 Convolution
ユーザー kotatsugamekotatsugame
提出日時 2020-02-11 21:51:58
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 217 bytes
コンパイル時間 527 ms
コンパイル使用メモリ 63,988 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-01 08:14:10
合計ジャッジ時間 2,487 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int N,A;
main()
{
	cin>>N;
	int X=0;
	for(int i=0;i<N;i++)
	{
		cin>>A;
		if(A>0)X=gcd(X,A);
	}
	cout<<(X==0?-1:(long)X*X)<<endl;
}
0