CF1225D.Power Products

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given nn positive integers a1,,ana_1, \ldots, a_n , and an integer k2k \geq 2 . Count the number of pairs i,ji, j such that 1i<jn1 \leq i < j \leq n , and there exists an integer xx such that aiaj=xka_i \cdot a_j = x^k .

输入格式

The first line contains two integers nn and kk ( 2n1052 \leq n \leq 10^5 , 2k1002 \leq k \leq 100 ).

The second line contains nn integers a1,,ana_1, \ldots, a_n ( 1ai1051 \leq a_i \leq 10^5 ).

输出格式

Print a single integer — the number of suitable pairs.

输入输出样例

  • 输入#1

    6 3
    1 3 9 8 24 1
    

    输出#1

    5
    

说明/提示

In the sample case, the suitable pairs are:

  • a1a4=8=23a_1 \cdot a_4 = 8 = 2^3 ;
  • a1a6=1=13a_1 \cdot a_6 = 1 = 1^3 ;
  • a2a3=27=33a_2 \cdot a_3 = 27 = 3^3 ;
  • a3a5=216=63a_3 \cdot a_5 = 216 = 6^3 ;
  • a4a6=8=23a_4 \cdot a_6 = 8 = 2^3 .
首页