记录详情

Wrong Answer

/in/foo.c: In function 'main':
/in/foo.c:16:14: warning: format '%lld' expects argument of type 'long long int', but argument 2 has type 'int' [-Wformat=]
   printf("%lld",fastpow(k+1,n,1000000007));
              ^
/in/foo.c:14:11: warning: unused variable 'ans' [-Wunused-variable]
   int k,n,ans;
           ^~~
# 状态 耗时 内存占用
#1 Wrong Answer 0ms 208.0 KiB
#2 Wrong Answer 0ms 128.0 KiB
#3 Wrong Answer 0ms 216.0 KiB
#4 Wrong Answer 0ms 128.0 KiB
#5 Wrong Answer 0ms 204.0 KiB

代码

#include<stdio.h>
#include<string.h>
#include<math.h>
int fastpow(long long int base,int n,long int mod){
	int ans=1;
	while(n){
		if(n&1)ans*=base%mod;
		base*=base;
		n>>=1;
	}
	return ans%mod;
}
int main(){
  int k,n,ans;
  scanf("%d%d",&n,&k);
  printf("%lld",fastpow(k+1,n,1000000007));
return 0;
}

信息

递交者
类型
递交
题目
P1005 hitwh 2019 新生赛 F Ramen and his faculty
语言
C
递交时间
2020-12-17 15:08:49
评测时间
2020-12-17 15:08:49
评测机
分数
0
总耗时
4ms
峰值内存
216.0 KiB