CF1225D.Power Products
普及+/提高
通过率:0%
时间限制:2.00s
内存限制:512MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given n positive integers a1,…,an, and an integer k≥2. Count the number of pairs i,j such that 1≤i<j≤n, and there exists an integer x such that ai⋅aj=xk.
给你 n 个正整数 a1,…,an 和一个整数 k≥2。请统计满足 1≤i<j≤n 且存在整数 x 使得 ai⋅aj=xk 的数对 (i,j) 的个数。
输入格式
The first line contains two integers n and k (2≤n≤105, 2≤k≤100).
The second line contains n integers a1,…,an (1≤ai≤105).
第一行包含两个整数 n 和 k(2≤n≤105,2≤k≤100)。
第二行包含 n 个整数 a1,…,an(1≤ai≤105)。
输出格式
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:
- a1⋅a4=8=23;
- a1⋅a6=1=13;
- a2⋅a3=27=33;
- a3⋅a5=216=63;
- a4⋅a6=8=23.
在样例中,符合条件的数对有:
- a1⋅a4=8=23;
- a1⋅a6=1=13;
- a2⋅a3=27=33;
- a3⋅a5=216=63;
- a4⋅a6=8=23。
输入解题思路,AI测评打分。不知道怎么写?