結果

問題 No.1146 土偶Ⅰ
ユーザー karinohitokarinohito
提出日時 2020-09-19 23:17:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 50 ms / 2,000 ms
コード長 1,354 bytes
コンパイル時間 865 ms
コンパイル使用メモリ 102,560 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 02:16:18
合計ジャッジ時間 2,447 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 7 ms
4,376 KB
testcase_04 AC 49 ms
4,380 KB
testcase_05 AC 9 ms
4,376 KB
testcase_06 AC 25 ms
4,380 KB
testcase_07 AC 40 ms
4,380 KB
testcase_08 AC 48 ms
4,376 KB
testcase_09 AC 16 ms
4,380 KB
testcase_10 AC 6 ms
4,376 KB
testcase_11 AC 22 ms
4,376 KB
testcase_12 AC 50 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 16 ms
4,376 KB
testcase_15 AC 41 ms
4,376 KB
testcase_16 AC 19 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 16 ms
4,376 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 5 ms
4,380 KB
testcase_22 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;

using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}
ll gcd(ll(a), ll(b)) {
	ll c = a;
	while (a % b != 0) {
		c = a % b;
		a = b;
		b = c;
	}
	return b;
}



int main() {

	ll N;
	cin >> N ;
	vector<ll> S(N);
	rep(i, N) {
		cin >> S.at(i);
	}
	ll an = 0;
	for (ll a1 = 0; a1 < N - 2; a1++) {
		for (ll a2 = a1+1; a2 < N - 1; a2++) {
			for (ll a3 = a2+1; a3 < N ; a3++) {
				if (gcd(gcd(S[a1], S[a2]), S[a3]) == 1)an++;
			}
		}
	}
	cout << an << endl;

}
0