![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
acm寒假作业
文章平均质量分 62
圆溜溜的奶黄包
这个作者很懒,什么都没留下…
展开
-
Digital root------[NWPU][2018寒假作业][通用版]一、热身 [Cloned]M题//求数字根的简便方法
The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resulting value contains two o原创 2018-01-22 22:55:38 · 159 阅读 · 0 评论 -
Dirichlet's Theorem on Arithmetic Progressions------[NWPU][2018寒假作业][通用版]一、热身 [Cloned]O题
If a and d are relatively prime positive integers, the arithmetic sequence beginning with a and increasing by d, i.e., a, a + d, a + 2d, a + 3d, a + 4d, …, contains infinitely many prime numbers. This原创 2018-01-22 23:19:21 · 130 阅读 · 0 评论 -
Ignatius and the Princess IV ------[NWPU][2018寒假作业][通用版]一、热身 [Cloned]J题
“OK, you are not too bad, em… But you can never pass the next test.” feng5166 says. “I will tell you an odd number N, and then N integers. There will be a special integer among them, you have to te原创 2018-01-22 23:26:47 · 156 阅读 · 0 评论 -
用归并排序求逆序对------二J
题目地址 https://vjudge.net/contest/205706#problem/J先学习了一下什么是归并排序 http://blog.csdn.net/yuehailin/article/details/68961304 又学习了一下怎么用归并排序求逆序对 http://blog.csdn.net/Sugar_Z_/article/details/48213537 于是原创 2018-01-30 22:03:18 · 166 阅读 · 0 评论 -
//栈//为什么我总把简单的问题搞那么复杂?//Ignatius Train Station------二X
题目在这里,我懒得复制了。解题思路: 其实这道题的想法很简单,就是把栈当作火车轨道,用程序模拟整个火车进站出站的过程。 一开始我做的特别复杂,各种讨论,各种情况。 后来发现其实不用想的很复杂,因为栈只能出栈或者入栈,只需要分清楚什么时候入栈、什么时候出栈、什么时候结束、怎么判断情况是否存在就可以了。 一开始栈为空的时候,只能将数压进去。 如果栈不为空且栈顶元素是要输出的元素,则出栈。 否原创 2018-01-31 16:49:42 · 157 阅读 · 0 评论 -
Joseph------[NWPU][2018寒假作业][通用版]一、热身 [Cloned]R题
The Joseph’s problem is notoriously known. For those who are not familiar with the original problem: from among n people, numbered 1, 2, …, n, standing in circle every mth is going to be executed and o原创 2018-01-24 16:35:59 · 222 阅读 · 0 评论 -
大水特水的水题//十进制转二进制//Bitset------二Z
这道题真的水的让人心情愉悦。做了好多题,终于做到一道真真正正的水题了,都要喜极而泣了QAQ#include#includeint main(){ int n,cnt,bi[20]; while(scanf("%d",&n)!=EOF) { memset(bi,0,sizeof(bi)); cnt=0; while(n!=0) { bi[cnt++]=n%2;原创 2018-01-30 23:19:41 · 144 阅读 · 0 评论 -
//优先队列//结构体重载//Stones------二W
Because of the wrong status of the bicycle, Sempr begin to walk east to west every morning and walk back every evening. Walking may cause a little tired, so Sempr always play some games this time. ...原创 2018-01-31 11:22:37 · 200 阅读 · 0 评论 -
//深搜//栈//Anagrams by Stack------二Y
How can anagrams result from sequences of stack operations? There are two sequences of stack operators which can convert TROT to TORT: [ i i i i o o o o i o i i o o i o ] where i st原创 2018-02-01 13:54:15 · 188 阅读 · 0 评论 -
stl的map2------[NWPU][2018寒假作业][通用版]二、stl ,模拟,贪心等 [Cloned]B题
Ignatius is so lucky that he met a Martian yesterday. But he didn’t know the language the Martians use. The Martian gives him a history book of Mars and a dictionary when it leaves. Now Ignatius wa...原创 2018-01-25 10:59:39 · 397 阅读 · 0 评论 -
//二分查找//Number Sequence------二O
A single positive integer i is given. Write a program to find the digit located in the position i in the sequence of number groups S1S2…Sk. Each group Sk consists of a sequence of positive integer numb原创 2018-02-01 17:02:48 · 487 阅读 · 1 评论 -
//16进制输入输出还有64位的int//又遇到水题了好开心------二N
There must be many A + B problems in our HDOJ , now a new one is coming. Give you two hexadecimal integers , your task is to calculate the sum of them,and print it in hexadecimal too. Easy ? AC原创 2018-02-01 17:27:44 · 347 阅读 · 0 评论 -
Doing Homework Again贪心------[NWPU][2018寒假作业][通用版]二、stl ,模拟,贪心等 [Cloned]P题
Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing in the homework. If Ignatius hands in the homework after the原创 2018-01-25 16:11:42 · 215 阅读 · 0 评论 -
Consistent Verdicts【LightOJ1410】------长篇阅读专场E题
In a 2D plane N persons are standing and each of them has a gun in his hand. The plane is so big that the persons can be considered as points and their locations are given as Cartesian coordinates. Eac原创 2018-01-26 10:27:29 · 114 阅读 · 0 评论 -
【欧拉函数】Bi-shoe and Phi-shoe【LightOJ1370】------长篇阅读专场D题
Bamboo Pole-vault is a massively popular sport in Xzhiland. And Master Phi-shoe is a very popular coach for his success. He needs some bamboos for his students, so he asked his assistant Bi-Shoe to go原创 2018-01-26 12:26:30 · 157 阅读 · 0 评论 -
//搞不清楚for循环真的害死人//贪心FatMouse's Trade------[NWPU][2018寒假作业][通用版]二E题
FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean. The warehouse has N rooms. The i-th room contains J[i] pounds of原创 2018-01-26 22:33:34 · 220 阅读 · 0 评论 -
Hero贪心2------[NWPU][2018寒假作业][通用版]二Q题
When playing DotA with god-like rivals and pig-like team members, you have to face an embarrassing situation: All your teammates are killed, and you have to fight 1vN. There are two key attributes原创 2018-01-25 17:50:38 · 205 阅读 · 0 评论 -
//动能定理和弹性势能//James Bond------[NWPU][2018寒假作业][通用版]二D题
Once again, James Bond is fleeing from some evil people who want to see him dead. Fortunately, he has left a bungee rope on a nearby highway bridge which he can use to escape from his enemies. His plan原创 2018-01-27 10:50:16 · 249 阅读 · 0 评论 -
//贪心//不光要排序//有两个大坑的好题//task------二R
Today the company has m tasks to complete. The ith task need xi minutes to complete. Meanwhile, this task has a difficulty level yi. The machine whose level below this task’s level yi cannot complete t原创 2018-02-03 11:25:09 · 192 阅读 · 0 评论 -
//为什么一直PE?//经营水果商店------[NWPU][2018寒假作业][通用版]二C题
夏天来了~好开心啊,呵呵,好多好多水果~~ Joe经营着一个不大的水果店.他认为生存之道就是经营最受顾客欢迎的水果.现在他想要一份水果销售情况的明细表,这样Joe就可以很容易掌握所有水果的销售情况了. Input 第一行正整数N,表示有N组测试数据. 每组测试数据的第一行是一个整数M,表示工有M次成功的交易.其后有M行数据,每行表示一次交易,由水果名称(小写字母...原创 2018-01-27 10:58:17 · 280 阅读 · 0 评论 -
//switch结构//Edge------[NWPU][2018寒假作业][通用版]一C题
For products that are wrapped in small packings it is necessary that the sheet of paper containing the directions for use is folded until its size becomes small enough. We assume that a sheet of paper原创 2018-01-27 11:11:08 · 156 阅读 · 0 评论 -
Robot Motion------[NWPU][2018寒假作业][通用版]一F题
A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. The possible instructions are N north (up the p原创 2018-01-27 11:19:19 · 179 阅读 · 0 评论 -
//sort的使用//把=打成==真可怕//Football Team------一G题
Football is one of the greatest games in the world. Lots of people like to play football. After one season of matches, the header has to calculate the last scores of every team. He is too lazy that...原创 2018-01-27 11:51:18 · 363 阅读 · 0 评论 -
//递推//折线分割平面------[NWPU][2018寒假作业][通用版]二F题
我们看到过很多直线分割平面的题目,今天的这个题目稍微有些变化,我们要求的是n条折线分割平面的最大数目。比如,一条折线可以将平面分成两部分,两条折线最多可以将平面分成7部分,具体如下所示。 Input 输入数据的第一行是一个整数C,表示测试实例的个数,然后是C 行数据,每行包含一个整数n(0大于n小于等于10000),表示折线的数量。 Output 对于每个测试实例原创 2018-01-27 15:48:23 · 160 阅读 · 0 评论 -
//贪心//从后往前枚举有奇效//Supermarket------二S
A supermarket has a set Prod of products on sale. It earns a profit px for each product x∈Prod sold by a deadline dx that is measured as an integral number of time units starting from the moment the sa原创 2018-02-03 16:08:22 · 177 阅读 · 0 评论 -
//贪心//二十行代码就能搞定买不了吃亏买不了上当//Yogurt Factory------二T
The cows have purchased a yogurt factory that makes world-famous Yucky Yogurt. Over the next N (1 <= N <= 10,000) weeks, the price of milk and labor will fluctuate weekly such that it will cost the com原创 2018-02-03 17:24:42 · 259 阅读 · 0 评论 -
//贪心//感觉做了假贪心的水题//Bin Packing------二U
A set of n 1-dimensional items have to be packed in identical bins. All bins have exactly the same length l and each item i has length li<=l . We look for a minimal number of bins q such that each原创 2018-02-03 17:49:17 · 178 阅读 · 0 评论 -
//scanf居然比cin快?//优先队列//Average Number------[NWPU][2018寒假作业][通用版]二G题
In a speech contest, when a contestant finishes his speech, the judges will then grade his performance. The staff remove the highest grade and the lowest grade and compute the average of the rest as th原创 2018-01-27 18:13:59 · 288 阅读 · 0 评论 -
FZU1575小学生的游戏([NWPU]萌新寒假第一次比赛——小学生专场A题)
题目 某天,无聊的小斌叫上几个同学玩游戏,其中有比较笨的小兴,比较傻的小雪,可爱的小霞和自以为是的小楠。他们去找聪明的小明去给他们当裁判。判定谁取得游戏胜利。 而这个游戏是由小斌想个1到10000000的数字让大家猜,看谁先猜中。为了防止小斌作弊,小明记录下了游戏的整个过程。你的任务是判断小斌是否有作弊。 Input 输入数据包括多盘游戏。一次猜数包含两行,第一行是一个数字n原创 2018-01-19 19:51:25 · 167 阅读 · 0 评论 -
//十进制转千进制//同余模定理//The Embarrassed Cryptographer------二H题
The young and very promising cryptographer Odd Even has implemented the security module of a large system with thousands of users, which is now in use in his company. The cryptographic keys are created原创 2018-01-28 13:54:18 · 384 阅读 · 0 评论 -
The 3n + 1 problem------[NWPU][2018寒假作业][通用版]一、热身 [Cloned]A题
Problems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In this problem you will be analyzing a property of an algorithm whose原创 2018-01-19 23:29:04 · 168 阅读 · 0 评论 -
A + B ------[NWPU][2018寒假作业][通用版]一、热身 [Cloned]E题
读入两个小于100的正整数A和B,计算A+B. 需要注意的是:A和B的每一位数字由对应的英文单词给出. Input 测试输入包含若干测试用例,每个测试用例占一行,格式为”A + B =”,相邻两字符串有一个空格间隔.当A和B同时为0时输入结束,相应的结果不要输出. Output 对每个测试用例输出1行,即A+B的值. Sample Input on原创 2018-01-19 23:18:51 · 189 阅读 · 0 评论 -
Candy Sharing Game------[NWPU][2018寒假作业][通用版]一、热身 [Cloned]B题
A number of students sit in a circle facing their teacher in the center. Each student initially has an even number of pieces of candy. When the teacher blows a whistle, each student simultaneously give原创 2018-01-19 23:39:21 · 230 阅读 · 0 评论 -
//斯特林公式//log10//求阶乘位数------二K
In many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryption, etc. In this problem you are given a number, you ha原创 2018-01-28 22:03:42 · 433 阅读 · 0 评论 -
//深搜//已经做过一遍了//求图像周长------三K
https://vjudge.net/contest/205707#problem/K 题目好长,懒得复制了。 这道题其实我已经做过一遍也写过一篇还挺详细的题解了。 http://blog.csdn.net/lydia_ke/article/details/78443167 这道题主要就两部分,第一部分确定图像范围,第二部分求图像周长。用深搜把点击的图像中的点找全并都标记成1原创 2018-02-09 11:56:45 · 190 阅读 · 0 评论 -
//dfs//传说中最经典的深搜//oil deposits[hdu 1241]------三L
https://vjudge.net/contest/205707#problem/L 题目地址在这里 特别简单的深搜题,从头开始遍历,每找到一个@油田数加1,然后用深搜把这块油田里的其他@都标记成1,防止后面找重。#include<stdio.h>int m,n;int xc[]={0,0,-1,1,1,-1,1,-1};int yc[]={1,-1,0,0,1,-1,-1,1原创 2018-02-09 13:52:27 · 132 阅读 · 0 评论 -
HDU2054 A==B------ [NWPU][2018寒假作业][通用版]一、热身 [Cloned]Y题
Give you two numbers A and B, if A is equal to B, you should print “YES”, or print “NO”. Input each test case contains two numbers A and B. Output for each case, if A is equal to B, you sh原创 2018-01-20 13:37:14 · 220 阅读 · 0 评论 -
不容易系列之(3)―― LELE的RPG难题------[NWPU][2018寒假作业][通用版]一、热身 [Cloned]D题
人称“AC女之杀手”的超级偶像LELE最近忽然玩起了深沉,这可急坏了众多“Cole”(LELE的粉丝,即”可乐”),经过多方打探,某资深Cole终于知道了原因,原来,LELE最近研究起了著名的RPG难题: 有排成一行的n个方格,用红(Red)、粉(Pink)、绿(Green)三色涂每个格子,每格涂一色,要求任何相邻的方格不能同色,且首尾两格也不同色.求全部的满足要求的涂法. 以上就是原创 2018-01-20 14:25:42 · 764 阅读 · 0 评论 -
//dfs深搜//WA了五百次//有多组数据注意清空数组或者控制边界//Curling[poj3009]------三M
https://vjudge.net/contest/205707#problem/M http://poj.org/problem?id=3009 题目链接在这 这道题我觉得思路不难,但是坑很多,AC用了好长时间。 刚开始是TLE,后来发现需要在深搜函数里加上下面这句,大于最小步数的就可以直接跳过。 if(move>=min) return; 后来一直WA,实在原创 2018-02-09 18:25:33 · 183 阅读 · 0 评论 -
//01背包//内存很小但是有点慢的非常简洁版本------四E
Bessie has gone to the mall’s jewelry store and spies a charm bracelet. Of course, she’d like to fill it with the best charms possible from the N (1 ≤ N ≤ 3,402) available charms. Each charm i in the s原创 2018-02-10 14:04:28 · 162 阅读 · 0 评论