QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#471327 | #8008. Fortune Wheel | LZL1251212203 | Compile Error | / | / | C++17 | 1.5kb | 2024-07-10 20:35:07 | 2024-07-10 20:35:07 |
Judging History
你现在查看的是最新测评结果
- [2024-07-30 15:38:33]
- hack成功,自动添加数据
- (/hack/759)
- [2024-07-10 20:35:07]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-07-10 20:35:07]
- 提交
answer
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<queue>
using namespace std;
const int N=4e7+10;
int n,bg,m;
int skl[N];
struct edge{
int nxt,to;
}e[N];
int head[N],tot,all;
void add(int u,int v){
e[++tot].nxt=head[u];
e[tot].to=v;
head[u]=tot;
}
int d[N];
double res;
double up,dw,sum[N];
bool vis[N];
void bfs() {
queue<int> q;
q.push(0);
d[0]=0;
vis[0]=1;
while(!q.empty()) {
int x=q.front();
q.pop();
for(int i=head[x];i;i=e[i].nxt) {
int to=e[i].to;
if(!vis[to]) {
vis[to]=1;
d[to]=d[x]+1;
q.push(to);
}
}
}
}
int gcd(int x,int y){
if(!y) return x;
return gcd(y,x%y);
}
int read(){
int ans=0;
char ch=getchar();
while(ch<'0'||ch>'9') ch=getchar();
while(ch>='0'&&ch<='9') ans=ans*10+(ch^48),ch=getchar();
return ans;
}
int main(){
n=read(),bg=read(),m=read();
memset(d,0x3f,sizeof(d));
for(int i=1;i<=m;i++) skl[i]=read();
for(int i=1;i<n;i++) {
for(int j=1;j<=m;j++) if((i+skl[j])%n!=i) add((i+skl[j])%n,i);
}
bfs();
// up=res=d[bg],dw=1;
// sort(d+1,d+n);
// for(int i=n;i>=2;i--) d[i]=d[i-1];
// d[1]=0;
// for(int i=1;d[i]!=1061109567&&i<=n;i++) {
// sum[i]=sum[i-1]+d[i];
// all++;
// }
// for(int i=1;i<=all;i++) {
// if((double)(n+sum[i])/i < res) {
// res=(double)(n+sum[i])/i;
// up=n+sum[i];
// dw=i;
// }
// }
// int g=gcd(up,dw);
cout<<up/g<<" "<<dw/g;
return 0;
}
/*
6 3 2
2 4
5 4 1
1
*/
Details
answer.code: In function ‘int main()’: answer.code:76:18: error: ‘g’ was not declared in this scope 76 | cout<<up/g<<" "<<dw/g; | ^