結果
問題 | No.1146 土偶Ⅰ |
ユーザー |
|
提出日時 | 2020-09-05 21:54:03 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 52 ms / 2,000 ms |
コード長 | 513 bytes |
コンパイル時間 | 732 ms |
コンパイル使用メモリ | 69,376 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-29 06:10:31 |
合計ジャッジ時間 | 2,082 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <iostream> #include <vector> using namespace std; typedef long long LL; LL gcd(LL a, LL b) { if (a<0){ a=-a; } if (b<0){ b=-b; } return b == 0 ? a : gcd(b, a % b); } class X{ LL x; LL y; LL z; }; int main() { int N,i,j,k; cin>>N; vector<LL> A(N); for (i=0;i<N;i++){ cin>>A[i]; } LL ans=0; LL G=0; for (i=0;i<N-2;i++){ for (j=i+1;j<N-1;j++){ for (k=j+1;k<N;k++){ G=gcd(A[i],gcd(A[j],A[k])); if (G==1){ ans++; } } } } cout<<ans<<endl; return 0; }