G: 又见模法师

Time Limit: 1 s      Memory Limit: 128 MB     
 
#include <stdio.h>
const int MOD=1e9+7;
typedef long long LL;
LL pow_mod(LL a,LL k,int MOD)
{
  LL s=1;
  while(k)
  {
    if(k&1)
      s=s*a%MOD;
    a=a*a%MOD;
    k>>=1;
  }
  return s;
}

int p[200001];

int main()
{
  int m;
  scanf("%d",&m);
  for(int i=0;i<m;i++)
  {
    int t=0;
    scanf("%d",&t);
    p[t]++;
  }
  LL prod=1;
  for(int i=0;i<=200000;i++)
    prod=prod*(1+p[i])%((MOD-1)*2);
  LL ans=1;
  for(int i=0;i<=200000;i++)
  {
    if(p[i])
    {
      LL cnt=prod*p[i]/2%(MOD-1);
      ans=ans*pow_mod(i,cnt,MOD)%MOD;
    }
  }
  printf("%lld\n",ans);
  return 0;
}

 

相关文章:

  • 2021-12-13
  • 2021-07-09
  • 2021-11-27
  • 2021-11-15
  • 2021-08-01
  • 2021-08-06
  • 2021-10-14
  • 2021-12-09
猜你喜欢
  • 2021-06-11
  • 2021-07-29
  • 2022-01-16
  • 2021-10-08
  • 2022-12-23
  • 2021-08-02
  • 2021-11-06
相关资源
相似解决方案