結果
問題 |
No.1146 土偶Ⅰ
|
ユーザー |
![]() |
提出日時 | 2020-08-12 20:55:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 48 ms / 2,000 ms |
コード長 | 523 bytes |
コンパイル時間 | 1,491 ms |
コンパイル使用メモリ | 168,516 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-09 18:34:59 |
合計ジャッジ時間 | 2,612 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; typedef pair<int, int> P; ll gcd(ll x, ll y) { if (y > x) swap(y, x); if (y == 0) return x; return gcd(y, x % y); } int main() { int n; cin >> n; vector<ll> a(n); REP(i, n) cin >> a[i]; ll ans = 0; REP(i, n - 2) for (int j = i + 1; j < n - 1; j++) for (int k = j + 1; k < n; k++) { ll Z = gcd(gcd(a[i], a[j]), a[k]); if (Z == 1) ans++; } cout << ans << endl; }