| 记录编号 | 313319 | 评测结果 | AAAAAAAAAA | ||
|---|---|---|---|---|---|
| 题目名称 | 2197.NO.1双塔问题 | 最终得分 | 100 | ||
| 用户昵称 | 是否通过 | 通过 | |||
| 代码语言 | C++ | 运行时间 | 0.002 s | ||
| 提交时间 | 2016-09-29 09:06:04 | 内存使用 | 0.29 MiB | ||
#include<cstdio>
#define LP 5201314
#define UP unsigned long long
using namespace std;
UP f(UP x)
{
if (x==1) return 3;
UP t=f(x>>1);
t=t*t%LP;
if (x&1) t=t*3%LP;
return t;
}
int main()
{
freopen("NO1shuta.in","r",stdin);
freopen("NO1shuta.out","w",stdout);
UP n; scanf("%lld",&n);
if (n==0) printf("0\n");
else printf("%lld",f(n)-1);
return 0;
}