Submission #1572991


Source Code Expand

Copy
#include<stdio.h>
int mbk(long long a,int n,int m){return n?(mbk((a*a)%m,n/2,m)*(n%2?a:1))%m:1;}
int inv(int a,int m){return mbk((long long)a,m-2,m);}
int aCb(int a,int b,int m){
  long long s=1,i;
  if(b>a-b)b=a-b;
  for(i=0;i<b;i++)s=(((s*(a-i))%m)*inv(i+1,m))%m;  
  return (int)s;
}
int main(){
	long long n,m,i,j,s=1,M=1e9+7;
	scanf("%lld %lld",&n,&m);
	m--;
	if(n<0)n=-n;
	for(i=2;i*i<=n;i++){
		for(j=0;n%i==0;j++)n/=i;
		s=s*aCb(j+m,m,M)%M;
	}
	if(n-1)s=s*(m+1)%M;
	printf("%lld\n",(s*mbk(2,m,M))%M);
	return 0;
}

Submission Info

Submission Time
Task D - 表現の自由 ( Freedom of expression )
User yuiop
Language C (GCC 5.4.1)
Score 100
Code Size 542 Byte
Status
Exec Time 1 ms
Memory 128 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:12:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld %lld",&n,&m);
  ^

Judge Result

Set Name Score / Max Score Test Cases
All 100 / 100 00_max.txt, 00_max2.txt, 00_max3.txt, 00_min.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, 01_rnd_00.txt, 01_rnd_01.txt, 01_rnd_02.txt, 01_rnd_03.txt, 01_rnd_04.txt, 01_rnd_05.txt, 01_rnd_06.txt, 01_rnd_07.txt, 01_rnd_08.txt, 01_rnd_09.txt, 01_rnd_10.txt, 01_rnd_11.txt, 01_rnd_12.txt, 01_rnd_13.txt, 01_rnd_14.txt, 01_rnd_15.txt, 01_rnd_16.txt, 01_rnd_17.txt, 01_rnd_18.txt, 01_rnd_19.txt, 01_rnd_20.txt, 01_rnd_21.txt, 01_rnd_22.txt, 01_rnd_23.txt, 01_rnd_24.txt, 01_rnd_25.txt, 01_rnd_26.txt, 01_rnd_27.txt, 01_rnd_28.txt, 01_rnd_29.txt, 04_primes_01.txt, 04_primes_02.txt
Case Name Status Exec Time Memory
00_max.txt 0 ms 128 KB
00_max2.txt 0 ms 128 KB
00_max3.txt 1 ms 128 KB
00_min.txt 0 ms 128 KB
00_sample_01.txt 1 ms 128 KB
00_sample_02.txt 1 ms 128 KB
00_sample_03.txt 0 ms 128 KB
00_sample_04.txt 0 ms 128 KB
01_rnd_00.txt 0 ms 128 KB
01_rnd_01.txt 1 ms 128 KB
01_rnd_02.txt 1 ms 128 KB
01_rnd_03.txt 1 ms 128 KB
01_rnd_04.txt 0 ms 128 KB
01_rnd_05.txt 0 ms 128 KB
01_rnd_06.txt 1 ms 128 KB
01_rnd_07.txt 1 ms 128 KB
01_rnd_08.txt 0 ms 128 KB
01_rnd_09.txt 1 ms 128 KB
01_rnd_10.txt 0 ms 128 KB
01_rnd_11.txt 0 ms 128 KB
01_rnd_12.txt 0 ms 128 KB
01_rnd_13.txt 1 ms 128 KB
01_rnd_14.txt 0 ms 128 KB
01_rnd_15.txt 1 ms 128 KB
01_rnd_16.txt 0 ms 128 KB
01_rnd_17.txt 1 ms 128 KB
01_rnd_18.txt 1 ms 128 KB
01_rnd_19.txt 0 ms 128 KB
01_rnd_20.txt 1 ms 128 KB
01_rnd_21.txt 0 ms 128 KB
01_rnd_22.txt 1 ms 128 KB
01_rnd_23.txt 1 ms 128 KB
01_rnd_24.txt 1 ms 128 KB
01_rnd_25.txt 1 ms 128 KB
01_rnd_26.txt 0 ms 128 KB
01_rnd_27.txt 1 ms 128 KB
01_rnd_28.txt 0 ms 128 KB
01_rnd_29.txt 0 ms 128 KB
04_primes_01.txt 1 ms 128 KB
04_primes_02.txt 1 ms 128 KB