Topic Portal
1 /*2 Test Instructions: Ask how many methods are chosen for the selection of 3 numbers into a geometric series3 The MAP:C1 record is the choice of the second or third number, and C2 represents the number of occurrences of all numbers. Other people's code is short, smart thinking4 */5 /************************************************6 * Author:running_time7 * Created time:2015-8-6 1:07:188 * File name:c.cpp9 ************************************************/Ten One#include <cstdio> A#include <algorithm> -#include <iostream> -#include <sstream> the#include <cstring> -#include <cmath> -#include <string> -#include <vector> +#include <queue> -#include <deque> +#include <stack> A#include <list> at#include <map> -#include <Set> -#include <bitset> -#include <cstdlib> -#include <ctime> - using namespacestd; in - #defineLson L, Mid, RT << 1 to #defineRson mid + 1, R, RT << 1 | 1 +typedefLong Longll; - Const intMAXN = 2e5 +Ten; the Const intINF =0x3f3f3f3f; * Const intMOD = 1e9 +7; $Map<ll, ll>C1, C2;Panax Notoginseng - intMainvoid) {//codeforces Round #Pi (Div. 2) C. Geometric progression thell ans =0, X; ll N, K; +scanf ("%i64d%i64d", &n, &k); A for(intI=1; i<=n; ++i) { thescanf ("%i64d", &x); + if(x% (k * k) = =0) ans + = c1[x/k];//x can be selected as a third number - if(x% k = =0) C1[x] + = c2[x/k];//x Third number or second number $c2[x]++; $ } - -printf ("%i64d\n", ans); the - return 0;Wuyi}
Map Codeforces Round #Pi (Div. 2) C. Geometric progression