当前位置: 首页 > 编程日记 > 正文

April Fools Contest 2018

这个比赛不正经,但是我可以一本正经的写代码啊

A. Quirky Quantifiers
time limit per test
2 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output
Input

The input contains a single integer a (10 ≤ a ≤ 999).

Output

Output 0 or 1.

Examples
input
Copy
13
output
1
input
Copy
927
output
1
input
Copy
48
output
0

蛇皮,题目什么都没,0和1,反正是A,猜奇偶吧

#include<bits/stdc++.h>
using namespace std;
int main()
{int n;cin>>n;cout<<(n&1);return 0;
}
B. A Map of the Cat
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat.

However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat.

You have met a cat. Can you figure out whether it's normal or grumpy?

Interaction

This is an interactive problem. Initially you're not given any information about the cat. Instead, the cat is divided into ten areas, indexed from 0 to 9.

In one query you can choose which area you'll pet and print the corresponding index to standard out. You will get the cat's response, as depicted on the corresponding map, via standard in. For simplicity all responses are written in lowercase.

Once you're certain what type of cat you're dealing with, output "normal" or "grumpy" to standard out.

Note

Please make sure to use the stream flushing operation after each query in order not to leave part of your output in some buffer.

B就直接阅读理解了么,这个脑洞大,让我组合的应该,不做这个

C. Ravioli Sort
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Everybody knows of spaghetti sort. You decided to implement an analog sorting algorithm yourself, but as you survey your pantry you realize you're out of spaghetti! The only type of pasta you have is ravioli, but you are not going to let this stop you...

You come up with the following algorithm. For each number in the array ai, build a stack of ai ravioli. The image shows the stack for ai = 4.

Arrange the stacks in one row in the order in which the corresponding numbers appear in the input array. Find the tallest one (if there are several stacks of maximal height, use the leftmost one). Remove it and add its height to the end of the output array. Shift the stacks in the row so that there is no gap between them. Repeat the procedure until all stacks have been removed.

At first you are very happy with your algorithm, but as you try it on more inputs you realize that it doesn't always produce the right sorted array. Turns out when two stacks of ravioli are next to each other (at any step of the process) and differ in height by two or more, the top ravioli of the taller stack slides down on top of the lower stack.

Given an input array, figure out whether the described algorithm will sort it correctly.

Input

The first line of input contains a single number n (1 ≤ n ≤ 10) — the size of the array.

The second line of input contains n space-separated integers ai (1 ≤ ai ≤ 100) — the elements of the array.

Output

Output "YES" if the array can be sorted using the described procedure and "NO" if it can not.

Examples
input
Copy
3
1 2 3
output
YES
input
Copy
3
3 1 2
output
NO
Note

In the second example the array will change even before the tallest stack is chosen for the first time: ravioli from stack of height 3 will slide on the stack of height 1, and the algorithm will output an array {2, 2, 2}.

做nmh,读不懂,我还是补线段树好了

转载于:https://www.cnblogs.com/BobHuang/p/8689958.html

相关文章:

如何查找僵尸进程并Kill之,杀不掉的要查看父进程并杀之

用ps和grep命令寻找僵尸进程#ps -A -ostat,ppid,pid,cmd | grep -e ^[Zz]命令注解&#xff1a;-A 参数列出所有进程-o 自定义输出字段 我们设定显示字段为 stat&#xff08;状态&#xff09;, ppid&#xff08;进程父id&#xff09;, pid(进程id)&#xff0c;cmd&#xff08;命…

PHP计划任务:如何使用Linux的Crontab执行PHP脚本(转)

我们的PHP程序有时候需要定时执行&#xff0c;我们可以使用ignore_user_abort函数或是在页面放置js让用户帮我们实现。但这两种方法都不太可靠&#xff0c;不稳定。我们可以借助Linux的Crontab工具来稳定可靠地触发PHP执行任务。下面介绍Crontab的两种方法。一、在Crontab中使用…

OpenAI 开放 GPT-3 微调功能,让开发者笑开了花

出品 | AI科技大本营&#xff08;ID:rgznai100&#xff09; 近日&#xff0c;OpenAI宣布&#xff0c;允许用户创建自定义版的 GPT-3。 OpenAI 表示&#xff0c;开发人员可以使用微调来创建针对其应用程序和服务中的特定内容量身定制的 GPT-3 模型&#xff0c;从而在任务和工作…

PHP----------php封装的一些简单实用的方法汇总

1、xml转换成array&#xff0c;格式不对的xml则返回false function xml_parser($str){ $xml_parser xml_parser_create(); if(!xml_parse($xml_parser,$str,true)){ xml_parser_free($xml_parser); return false; } else { …

PHP函数--var_dump

var_dump(PHP 3 > 3.0.5, PHP 4, PHP 5)var_dump -- 打印变量的相关信息描述void var_dump ( mixed expression [, mixed expression [, ...]] )此函数显示关于一个或多个表达式的结构信息&#xff0c;包括表达式的类型与值。数组将递归展开值&#xff0c;通过缩进显示其结构…

Mozilla公布WebVR API标准草案

随着信息技术的迅速发展&#xff0c;虚拟现实&#xff08;Virtual Reality&#xff0c;VR&#xff09;技术在近些年不断完善&#xff0c;其应用范围也变得十分广泛。为了搭建逼真的虚拟场景&#xff0c;VR技术一般都需要用到大量精美的图像和复杂的动作。因此&#xff0c;大部分…

不到 100 行 Python 代码教你做出精美炫酷的可视化大屏

作者 |俊欣来源 |关于数据分析与可视化“碳达峰、碳中和”是2021年政府在不断强调与非常重视的事儿&#xff0c;那什么是“碳达峰”、什么又是“碳中和”呢&#xff1f;这里小编来为大家科普一下&#xff0c;所谓的“碳达峰”指的是在某一时间点&#xff0c;二氧化碳的排放不再…

JavaScript实现冒泡排序

说明 对数组进行 冒泡排序 算是比较简单的&#xff0c;冒泡排序也是容易理解的一种排序算法了&#xff0c;在面试的时候&#xff0c;很可能就会问到。 实现原理 数组中有 n 个数&#xff0c;比较每相邻两个数&#xff0c;如果前者大于后者&#xff0c;就把两个数交换位置&#…

PHP--isset()和unset()函数的用法

isset(PHP 3, PHP 4, PHP 5 )isset -- 检测变量是否设置描述bool isset ( mixed var [, mixed var [, ...]])如果 var 存在则返回 TRUE&#xff0c;否则返回 FALSE。 如果已经使用 unset() 释放了一个变量之后&#xff0c;它将不再是 isset()。若使用 isset() 测试一个被设置成…

有关任意多条曲线的拟合度算法

为什么80%的码农都做不了架构师&#xff1f;>>> 在股市中&#xff0c;经常会遇到趋势的预判。所谓趋势&#xff0c;即相对而言的规律化的模式识别形态。形象来讲&#xff0c;就是个股的一段时间内的曲线分布状况。 那么&#xff0c;问题来了。 我们虽然可以在少量的…

从深度学习到深度森林方法(Python)

作者 |泳鱼来源 |算法进阶一、深度森林的介绍 目前深度神经网络&#xff08;DNN&#xff09;做得好的几乎都是涉及图像视频&#xff08;CV&#xff09;、自然语言处理&#xff08;NLP&#xff09;等的任务&#xff0c;都是典型的数值建模任务&#xff08;在表格数据tabular dat…

LHC大神问的矩阵转置问题

数学中线性代数中提到的矩阵转置&#xff0c;其实在我们的业务场景中也有需要的地方&#xff0c;比如LHC大神问到的这个问题 那么如何进行行列转换呢&#xff1f; 代码如下&#xff1a; <?php$arrayarray(部门1>array(费用1>100,费用2>200,费用3>300),部门2>…

不同机器互相调用WebService或者HTTP一定要telnet 测试

ping的通不一定就telnet的通 一定要#telnet 目标机器IP 目标机器端口如果一直是 Trying 目标IP那么不通如果是 Trying 目标IP Connection to 目标IP 说明通的

亮相百度WAVE SUMMIT+2021,Intel OpenVINO带来新气象

北京时间12月12日&#xff0c;百度WAVE SUMMIT2021深度学习开发者峰会在上海举办。这场属于AI的科技盛会之上&#xff0c;英特尔OpenVINO联手百度PaddlePaddle为开发者带来了一系列的技术内容&#xff0c;为开源生态构建持续合作&#xff0c;为产业进步提供新的动力。 OpenVIN…

精品德国软件 UltraShredder 文件粉碎机

出自德国的文件粉碎机&#xff0c;整合了回收站的相关操作&#xff0c;特点是兼容性好&#xff0c;支持9X以上的Win全系列&#xff08;不包括64位系统哦&#xff09;。该软件绿色免费&#xff0c;建议收藏于U盘^_^ 它和偶之前汉化的加密软件Omziff一样&#xff0c;来自XTort&am…

JavaEE 银联支付之手机控件支付-消费类交易

0. workflow app端request->后台封装参数->后台进行签名->请求银联平台->解析响应->响应需求信息 复制代码1. acp_sdk.properties ##############SDK配置文件&#xff08;证书方式签名&#xff09;################ # 说明&#xff1a; # 1. 使用时请删除后缀的…

php singleton()

common.php <?phpclass CC{private static $ins;public static function singleton(){if (!isset(self::$ins)){$c __CLASS__;self::$ins new $c;}return self::$ins;}public function EventResult($Id){return $Id;}}?>index.php <html><head><title…

2015 Multi-University Training Contest 2 1002 Buildings

Buildings Problems Link: http://acm.hdu.edu.cn/showproblem.php?pid5301 Mean: n*m列的网格&#xff0c;删除一个格子x,y&#xff0c;用矩形来填充矩阵。且矩形至少有一边是在矩阵的边缘上。 要使最大矩形的面积最小&#xff0c;求满足条件的矩形填充方式中面积最大的…

Meta 发布 Bean Machine 帮助衡量 AI 模型的不确定性

编译 | 禾木木 出品 | AI科技大本营&#xff08;ID:rgznai100&#xff09; Meta 近日宣布发布 Bean Machine&#xff0c;这是一种概率编程系统&#xff0c;表面上可以更轻松地表示和了解 AI 模型中的不确定性。 在早期测试版中&#xff0c;Bean Machine 可用于通过自动的“不确…

【跃迁之路】【425天】刻意练习系列184—SQL(2018.04.06)

(跃迁之路)专栏 叨叨两句 技术的精进不能只是简单的刷题&#xff0c;而应该是不断的“刻意”练习该系列改版后正式纳入【跃迁之路】专栏&#xff0c;持续更新刻意练习——MySQL 2018.04.02 题目描述 DROP TABLE IF EXISTS test1;CREATE TABLE test1 (id int(11) NOT NULL AUTO_…

安利一个超好用的 Pandas 数据挖掘分析神器

作者 |欣一来源 |Python爱好者集中营今天小编继续来给大家介绍一款用于做EDA(探索性数据分析)的利器&#xff0c;并且可以自动生成代码&#xff0c;帮助大家极大节省工作时间与提升工作效率的利器&#xff0c;叫做Bamboolib。大家可以将其理解为是Pandas的GUI扩展工具&#xff…

PHP魔术常量

PHP 向它运行的任何脚本提供了大量的预定义常量。不过很多常量都是由不同的扩展库定义的&#xff0c;只有在加载了这些扩展库时才会出现&#xff0c;或者动态加载后&#xff0c;或者在编译时已经包括进去了。 有七个魔术常量它们的值随着它们在代码中的位置改变而改变。例如 _…

vim 打开Linux下文件每一行后面都有^M的样式

由于服务器不是我一个人在操作&#xff0c;在修改apache配置文件时发现了一个很奇怪的问题&#xff0c;vim编辑打开配置文件发现后面都有一个^M的标记 虽然不会影响服务的运行&#xff0c;但总感觉不对劲&#xff0c;所以在此我尝试用替换的方式来设置它 :%s/\^M//g 虽然也成功…

所有类是object的子类,但是又可以继承一个其他类解析

所有类的祖宗是object&#xff0c;所有类只能有一个父亲。Java的单继承指的是一个类不能有多个父亲&#xff0c;而C就能有好多父亲。举个例子&#xff1a;如果A 没有继承任何类&#xff0c;那他的类层次关系默认是 A -- Object如果A 继承了类B&#xff0c;那他的类层次关系变为…

Smarty中文手册,Smarty教程,Smarty模板的入门教材

Smarty中文手册,Smarty教程,Smarty模板的入门教材首先&#xff0c;这份Smarty中文手册的翻译工作是由喜悦国际村村民自发组织的&#xff0c;不代表任何人的意见和观点。对他们的无私奉献精神&#xff0c;我们表示感谢&#xff0c;他们为Smarty模板的普及作出了重大的贡献&#…

380万播放量,也许是全网最火的机器学习视频

“秋名山上行人稀&#xff0c;常有车手较高低。如今无人车当道&#xff0c;全是 AI 老司机。”且问 AI 老司机表现如何&#xff1f;可灵活转弯&#xff0c;控速自如&#xff1a;可行云流水&#xff0c;沿最优路线过弯&#xff1a;更可多次打圈&#xff0c;绕多少下也不在话下&a…

《SQL Server 管理与维护指南》章节目录

http://www.mssqlmct.cn/?post2转载于:https://blog.51cto.com/mssqlmct/1677763

Java并发之synchronized

synchronized关键字最主要有以下3种应用方式 修饰实例方法&#xff0c;作用于当前实例加锁&#xff0c;进入同步代码前要获得当前实例的锁&#xff1b;实例锁&#xff0c;一个实例一把锁 修饰静态方法&#xff0c;作用于当前类对象加锁&#xff0c;进入同步代码前要获得当前类对…

java 产生的固体物的基础上 增删改的SQL声明

经过多次修改。最后版本。package com.power.sql;import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.List; import java.util.Vector;import org.apache.commons.lang3.reflect.FieldUtils; /*** author Gary Huang* 博客地址&#xff1a;…

顺络新能源汽车技术研讨会圆满落幕

2021年12月11日&#xff0c;由深圳顺络电子股份有限公司主办、中国传感器与物联网产业联盟和大湾区新能源汽车产业技术创新联盟协办的新能源汽车技术研讨会在深圳汉普斯酒店隆重召开&#xff0c;广汽研究院智能网联中心总师廖磊先生、比亚迪汽车工程研究院副总工程师顾建军先生…