随笔分类 -  ACM

1
摘要:B - Phone Numbers 链接:https://codeforces.com/problemset/problem/151/B 题意: 从形如“XX-XX-XX”由数字构成的电话号码中寻找分别拥有每种类型的电话号码的最大数量的朋友, 出租车号码由6个相同的数字组成(例如,22-22-22) 阅读全文
posted @ 2021-05-22 16:40 nanmoon 阅读(41) 评论(0) 推荐(0)
摘要:A - A CodeForces - 991A Each student eagerly awaits the day he would pass the exams successfully. Thus, Vasya was ready to celebrate, but, alas, he di 阅读全文
posted @ 2021-02-07 14:09 nanmoon 阅读(158) 评论(0) 推荐(0)
摘要:A - A CodeForces - 994A You are locked in a room with a door that has a keypad with 10 keys corresponding to digits from 0 to 9. To escape from the ro 阅读全文
posted @ 2021-02-07 13:47 nanmoon 阅读(86) 评论(0) 推荐(0)
摘要:A - A CodeForces - 879A It seems that Borya is seriously sick. He is going visit n doctors to find out the exact diagnosis. Each of the doctors needs 阅读全文
posted @ 2021-01-25 21:10 nanmoon 阅读(85) 评论(0) 推荐(0)
摘要:B - Lucky Mask Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lu 阅读全文
posted @ 2020-12-20 22:02 nanmoon 阅读(127) 评论(0) 推荐(0)
摘要:L1-6 吃火锅 (15分) 以上图片来自微信朋友圈:这种天气你有什么破事打电话给我基本没用。但是如果你说“吃火锅”,那就厉害了,我们的故事就开始了。 本题要求你实现一个程序,自动检查你朋友给你发来的信息里有没有 chi1 huo3 guo1。 输入格式: 输入每行给出一句不超过 80 个字符的、以 阅读全文
posted @ 2020-12-05 20:09 nanmoon 阅读(372) 评论(0) 推荐(0)
摘要:7-4 倒数第N个字符串 (15分) 给定一个完全由小写英文字母组成的字符串等差递增序列,该序列中的每个字符串的长度固定为 L,从 L 个 a 开始,以 1 为步长递增。例如当 L 为 3 时,序列为 { aaa, aab, aac, ..., aaz, aba, abb, ..., abz, .. 阅读全文
posted @ 2020-11-23 20:20 nanmoon 阅读(109) 评论(0) 推荐(0)
摘要:7-11 集合相似度 (25分) 给定两个整数集合,它们的相似度定义为:/。其中N​c​​是两个集合都有的不相等整数的个数,N​t​​是两个集合一共有的不相等整数的个数。你的任务就是计算任意一对给定集合的相似度。 输入格式: 输入第一行给出一个正整数N(≤),是集合的个数。随后N行,每行对应一个集合 阅读全文
posted @ 2020-11-22 20:37 nanmoon 阅读(87) 评论(0) 推荐(0)
摘要:7-1 阅览室 (20分) 天梯图书阅览室请你编写一个简单的图书借阅统计程序。当读者借书时,管理员输入书号并按下S键,程序开始计时;当读者还书时,管理员输入书号并按下E键,程序结束计时。书号为不超过1000的正整数。当管理员将0作为书号输入时,表示一天工作结束,你的程序应输出当天的读者借书次数和平均 阅读全文
posted @ 2020-11-15 21:54 nanmoon 阅读(114) 评论(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 阅读(163) 评论(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 阅读(83) 评论(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 阅读(100) 评论(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 阅读(99) 评论(0) 推荐(0)
摘要:7-9 排座位 布置宴席最微妙的事情,就是给前来参宴的各位宾客安排座位。无论如何,总不能把两个死对头排到同一张宴会桌旁!这个艰巨任务现在就交给你,对任何一对客人,请编写程序告诉主人他们是否能被安排同席。 输入格式: 输入第一行给出3个正整数:N(≤100),即前来参宴的宾客总人数,则这些人从1到N编 阅读全文
posted @ 2020-10-04 20:19 nanmoon 阅读(144) 评论(0) 推荐(0)
摘要:D.Dividing by Two 题意:给定两个数a,b,通过最少的操作使a,b相等, 可以执行的操作只有a=a/2(a为偶数)和a=a+1 思路:当a<=b时,可以进行的操作只有a=a+1; 当a>b时,尽可能多的使a=a/2,当a<b时再a=a+1; AC代码: #include<iostre 阅读全文
posted @ 2020-05-06 21:24 nanmoon 阅读(126) 评论(0) 推荐(0)
摘要:C.最长非公共子序列 思路:思维题,有两段字符串,要求出最长不相同子序列的长度, 考虑到两个字符串完全相同的情况下是没有不相同子序列的, 而两个字符串不同时直接输出较长那个字符串的长度即可。 AC代码: #include<iostream> #include<algorithm> #include< 阅读全文
posted @ 2020-04-26 21:18 nanmoon 阅读(108) 评论(0) 推荐(0)
摘要:UCF Local Programming Contest 2017 B : Simplified Keyboard 题目大意:给出一个字母分布图,如果两个字符串对应位置的字母全都相等,字符串属性为1;若两个字符串对应位置字母均相邻或相等,字符串属性为2;其他字符串属性为3. 现给出两个字符串,问这 阅读全文
posted @ 2020-04-12 17:33 nanmoon 阅读(108) 评论(0) 推荐(0)
摘要:D. Wildest Dreams 这道题的意思是Ayna和Arup两人会同时在车上一段时间,在Ayna在的时候,必须单曲循环Ayna喜欢的歌,偶数段Ayna下车,若此时已经放了她喜欢的那首歌,就要将它放完,然后按照顺序播放其他的歌,输出一共播放了Ayna喜欢的歌多少分钟。 分情况考虑,加起来总和就 阅读全文
posted @ 2020-04-05 20:47 nanmoon 阅读(134) 评论(0) 推荐(0)
摘要:J. Jazz it Up!题目要求,n*m的因子中不能含有平方形式,且题目中已经说明n是一个无平方因子的数, 那么只要m是无平方因子的数,并且n和m没有共同的因子即可.要注意时间复杂度!代码:#include<iostream> #include<algorithm> #include<cmath 阅读全文
posted @ 2020-03-30 11:59 nanmoon 阅读(151) 评论(0) 推荐(0)
摘要:I题 求 a 数组平方的前缀和和求 a 数组后缀和,遍历一遍即可 AC代码 #include<iostream>#include<cmath>using namespace std;int a[1000005];long long l[1000005], r[1000005];int main(){ 阅读全文
posted @ 2020-03-18 18:33 nanmoon 阅读(165) 评论(0) 推荐(0)

1