POJ 2575
#include<iostream>
#include<set>
#include<stdio.h>
using namespace std; int my_abs(int);
int main()
{
//freopen("acm.acm","r",stdin);
int num;
int i;
int * a;
set<int> coll;
while(cin>>num)
{
a = new int[num];
for(i = ; i < num; ++ i)
{
cin>>a[i];
}
for(i = ; i < num - ; ++ i)
{
coll.insert(my_abs(a[i] - a[i+]));
}
if((coll.size() == num - &&*coll.begin() == && *coll.rbegin() == num - ||num == ))
cout<<"Jolly"<<endl;
else
cout<<"Not jolly"<<endl;
coll.clear();
delete[] a;
}
}
int my_abs(int num)
{
if(num >= )
return num;
else
return num * (-); }
POJ 2575的更多相关文章
- POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理
Halloween treats Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 7644 Accepted: 2798 ...
- POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理
Find a multiple Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7192 Accepted: 3138 ...
- POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治
The Pilots Brothers' refrigerator Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 22286 ...
- POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法
Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 37427 Accepted: 16288 Descr ...
- POJ 3254. Corn Fields 状态压缩DP (入门级)
Corn Fields Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 9806 Accepted: 5185 Descr ...
- POJ 2739. Sum of Consecutive Prime Numbers
Sum of Consecutive Prime Numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20050 ...
- POJ 2255. Tree Recovery
Tree Recovery Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11939 Accepted: 7493 De ...
- POJ 2752 Seek the Name, Seek the Fame [kmp]
Seek the Name, Seek the Fame Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 17898 Ac ...
- poj 2352 Stars 数星星 详解
题目: poj 2352 Stars 数星星 题意:已知n个星星的坐标.每个星星都有一个等级,数值等于坐标系内纵坐标和横坐标皆不大于它的星星的个数.星星的坐标按照纵坐标从小到大的顺序给出,纵坐标相同时 ...
随机推荐
- layer.alert没有垂直居中
经查找是因为 <!DOCTYPE html> 这句没有写在整个页面的最顶部,将其放在整个页面的第一行就可以了. ps:原理不是很清楚
- c#多线程编程实战(原书第二版)文摘
Thread t = new Thread(PrintNumbersWithDelay); t.Start(); t.Join(); 但我们在主程序中调用了t.Join方法,该方法允许我们等待直到线程 ...
- SPRING 事务管理说明
spring 事务管理是通过AOP拦截指定的方法,进行事务管理. 事务配置 <aop:config proxy-target-class="true"> <aop ...
- shell常见命令
awk awk是个很好用的东西,大量使用在linux系统分析的结果展示处理上.并且可以使用管道, input | awk '' | output 1.首先要知道形式 awk 'command' fi ...
- 解决普通用户sudo时出现/usr/bin/sudo must be owned by uid 0 and have the setuid bit set
一:因为之前误操作使用sudo chmod -R 777 /usr命令修改了usr文件的所有者导致了此问题: 二:网上说需要进入recovery mode,经过自己的测试是不需要的: 三:步骤(只需登 ...
- Android: Custom View和include标签的区别
Custom View, 使用的时候是这样的: <com.example.home.alltest.view.MyCustomView android:id="@+id/customV ...
- currentTarget
定义和用法 currentTarget 事件属性返回其监听器触发事件的节点,即当前处理该事件的元素.文档或窗口. 在捕获和起泡阶段,该属性是非常有用的,因为在这两个节点,它不同于 target 属性. ...
- 20145232 韩文浩 《Java程序设计》第2周学习总结
教材学习内容总结 这周主要学习了注释的使用,运算符的基本使用,认识了类型,变量与常量,以及一些语句语法.复习了进制转换. 整数 Short整数占用2字节,储存整数范围-32768 ~ 32767(2- ...
- noip第11课资料
- 13.2.DataGrid增、删、改、查后台实现
一.UserServlet: 二:Dao接口: 三:Dao接口的实现类: