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个星星的坐标.每个星星都有一个等级,数值等于坐标系内纵坐标和横坐标皆不大于它的星星的个数.星星的坐标按照纵坐标从小到大的顺序给出,纵坐标相同时 ...
随机推荐
- java 后台 post请求 携带参数 远程操作 调用接口
package com.huayu.tizong.matchteam.util; import java.io.BufferedReader; import java.io.IOException; ...
- java web 大文件下载
泽优大文件下载产品测试 泽优大文件下载控件down2,基于php开发环境测试. 开发环境:HBuilder 服务器:wamp64 数据库:mysql 可视化数据库编辑工具:Navicat Premiu ...
- 添加全局函数$.extend和对象方法$.fn
## $(function () { $.fn.shadow = function (opts) { return this.each(function () { var defaults = { / ...
- mybatis的update操作的几种动态更新
mybatis是我们开发者常用的dao框架,亿轻巧灵活为特征,在crud操作中,动态更新是常用的操作.我搜集了两种动态更新的sql写法,以备日后备用! 方法1: update loan_product ...
- android webview使用心得 屏幕宽度自适应
webview中右下角的缩放按钮能不能去掉 settings.setDisplayZoomControls(false); //隐藏webview缩放按钮 让Webview加载的页面居中显示有我知道的 ...
- Windows下Django环境搭建
总体示意图如下: Windows下搭建Django环境 1.安装Python版本 2.安装pip工具,一般Python安装都会自动会有这个,在你python安装命令下Scripts文件夹下 3.dj ...
- js跳转页面方法实现汇总
一.页面之间的跳转传参 1.在页面之间跳转的方式有两种: window.location.href=”test.html?num=10” 地址会改变参数也会被传递但是不会打开新窗口 window. ...
- hdu 4940 数据太水...
http://acm.hdu.edu.cn/showproblem.php?pid=4940 给出一个有向强连通图,每条边有两个值分别是破坏该边的代价和把该边建成无向边的代价(建立无向边的前提是删除该 ...
- toast js
参考别人的,自己改写了下,很好用. <!DOCTYPE html> <html lang="zh-CN"> <head> <meta ch ...
- POJ 2570 线段树
Potted Flower Time Limit: 2000 MS Memory Limit: 65536 KB 64-bit integer IO format: %I64d , %I64u Jav ...