社区讨论

各位神犇,这个代码怎么了??为什么用Dev-C++编译不了??

P1152欢乐的跳参与者 6已保存回复 6

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
6 条
当前快照
1 份
快照标识符
@mi6te4b6
此快照首次捕获于
2025/11/20 10:30
4 个月前
此快照最后确认于
2025/11/20 10:30
4 个月前
查看原帖
#include<bits/stdc++.h> #define ok 1005
using namespace std;
int n,a[ok],b[ok];
void input() {
CPP
scanf("%d",&n);
for(int i=1;i<=n;i++)
 scanf("%d",a[i]);
}
void work() {
CPP
for(int i=1;i<n;i++)
 b[i]=abs(a[i]-a[i+1]);
sort(b+1,b+n);
}
bool check() {
CPP
for(int i=1;i<n;i++)
 if(b[i]!=i)
  return false;
return true;
}
void output() {
CPP
if(check())
 cout<<"Jolly";
else
 cout<<"Not jolly";
}
int main() {
CPP
input();
work();
check();
output();
return 0;
}

回复

6 条回复,欢迎继续交流。

正在加载回复...