QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#67176 | #5099. 朝圣道 | hleternity | Compile Error | / | / | C++14 | 1.4kb | 2022-12-10 10:19:17 | 2022-12-10 10:19:47 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2022-12-10 10:19:47]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2022-12-10 10:19:17]
- 提交
answer
#include<bits/stdc++.h>
#include "pilgrimage.h"
using namespace std;
#define int long long
#define N 1000009
inline int read()
{
register int x=0;
register char ch=cin.get();
register bool op=0;
while(!isdigit(ch)) {if(ch=='-')op=1;ch=cin.get();}
while(isdigit(ch)) {(x*=10)+=(ch^48);ch=cin.get();}
return op? -x:x;
}
int x,y,p,n,o,T;
int ans;
inline void exgcd(register int a,register int b)
{
if(!b) {x=1,y=0;return;}
exgcd(b,a%b);
int nx=x;
x=y;
y=nx-a/b*y;
}
int inv[N];
inline int INV(register int k)
{
if(inv[k]) return inv[k];
x=0,y=0;
exgcd(k,p);
inv[k]=(x%p+p)%p;
return inv[k];
}
inline void dfs(register int a,register int cnt,register int w)
{
if(cnt==n) return ans+=a*abs(w),void();
for(register int i(1);i<=3;++i)
{
if(i==1) dfs(a*INV(4)%p,cnt+1,w-1);
if(i==2) dfs(a*INV(2)%p,cnt+1,w);
if(i==3) dfs(a*INV(4)%p,cnt+1,w+1);
}
}
inline void init(int o,int p){ans=0;}
inline int ask(long long n)
{
ans=0;
dfs(1,0,0);
return ans;
}
signed main()
{
ios::sync_with_stdio(0);
// freopen("b.in","r",stdin);
//freopen("b.out","w",stdout);
o=read();T=read();p=read();init(0,0);
for(register int i(1);i<=T;++i)
{
n=read();
printf("%lld\n", ask(n)%p);
}
return 0;
}
详细
answer.code:45:12: error: ambiguating new declaration of ‘long long int ask(long long int)’ 45 | inline int ask(long long n) | ^~~ In file included from answer.code:2: pilgrimage.h:3:5: note: old declaration ‘int ask(long long int)’ 3 | int ask (long long n); | ^~~