摘要: 7-1 阅览室 (20分) 天梯图书阅览室请你编写一个简单的图书借阅统计程序。当读者借书时,管理员输入书号并按下S键,程序开始计时;当读者还书时,管理员输入书号并按下E键,程序结束计时。书号为不超过1000的正整数。当管理员将0作为书号输入时,表示一天工作结束,你的程序应输出当天的读者借书次数和平均 阅读全文
posted @ 2020-11-15 21:54 nanmoon 阅读(98) 评论(0) 推荐(0) 编辑
摘要: B Long time ago Alex created an interesting problem about parallelogram. The input data for this problem contained four integer points on the Cartesia 阅读全文
posted @ 2020-11-08 20:25 nanmoon 阅读(116) 评论(0) 推荐(0) 编辑
摘要: E Nothing is eternal in the world, Kostya understood it on the 7-th of January when he saw partially dead four-color garland. Now he has a goal to rep 阅读全文
posted @ 2020-11-01 20:27 nanmoon 阅读(67) 评论(0) 推荐(0) 编辑
摘要: B - Power Sequence Let's call a list of positive integers a0,a1,...,an−1a0,a1,...,an−1 a power sequence if there is a positive integer cc, so that for 阅读全文
posted @ 2020-10-25 21:26 nanmoon 阅读(76) 评论(0) 推荐(0) 编辑
摘要: 10.9 B - A Tide of Riverscape Walking along a riverside, Mino silently takes a note of something. "Time," Mino thinks aloud. "What?" "Time and tide wa 阅读全文
posted @ 2020-10-18 22:30 nanmoon 阅读(72) 评论(0) 推荐(0) 编辑
摘要: 7-9 排座位 布置宴席最微妙的事情,就是给前来参宴的各位宾客安排座位。无论如何,总不能把两个死对头排到同一张宴会桌旁!这个艰巨任务现在就交给你,对任何一对客人,请编写程序告诉主人他们是否能被安排同席。 输入格式: 输入第一行给出3个正整数:N(≤100),即前来参宴的宾客总人数,则这些人从1到N编 阅读全文
posted @ 2020-10-04 20:19 nanmoon 阅读(121) 评论(0) 推荐(0) 编辑
摘要: A - Sum of Odd Integers 题意:给定n和k,求是否存在k个不同的正奇数和为n. 解题思路:n和k奇偶性应相同,且1+3+5+...+2k−1=k^2,故n>=k*k. ac代码: #include<iostream> using namespace std; int main( 阅读全文
posted @ 2020-06-12 23:17 nanmoon 阅读(178) 评论(0) 推荐(0) 编辑
摘要: A - Dreamoon and Ranking Collection 题意:给定长为n的数组和可以给数组加上任意数字的次数x,求这个数组从1到v最大可以连续到的数v. 解题思路:先记录原数组的数字,再从1开始遍历,看存在就不添加,然后再从得到的最后一个数开始遍历,看原数组是否还有连续数. ac代码 阅读全文
posted @ 2020-06-04 00:02 nanmoon 阅读(146) 评论(0) 推荐(0) 编辑
摘要: A - Sorted Adjacent Differences 题意:给定数组,对其排序,使其满足|a1−a2|≤|a2−a3|≤…≤|an−1−an|. 解题思路:先对数组进行排序,由最大值与最小值之差最大,次大值与次小值之差第二大,依次类推,将数组从中间开始输出. ac代码: #include< 阅读全文
posted @ 2020-05-29 20:36 nanmoon 阅读(158) 评论(0) 推荐(0) 编辑
摘要: F - Construct the String 题意:给定n,a,b,求长度为n,每a个字母含有b个不同的字母的字符串. 解题思路:创建长度为b,前a个字母不同的字符串循环输出即可. ac代码: #include<iostream>using namespace std;char s[2005]; 阅读全文
posted @ 2020-05-24 09:26 nanmoon 阅读(95) 评论(0) 推荐(0) 编辑