
acm
文章平均质量分 60
叫我AC
不写注释就是耍流氓
展开
-
ACM之C++ STL库
全排列函数next_permutationSTL 中专门用于排列的函数(可以处理存在重复数据集的排列问题)头文件:#include <algorithm>using namespace std;调用: next_permutation(start, end);注意:函数要求输入的是一个升序排列的序列的头指针和尾指针.用法:// 数组int a[N];sort(a, a+N);next...转载 2018-04-19 20:27:15 · 1098 阅读 · 0 评论 -
去重函数
sort(a,a+n); n = unique(a,a+n) - a;#include #include #include using namespace std; const int N = 100000; int a[N+5]; int main() { int n; while (cin>>n) {原创 2017-08-07 09:39:18 · 816 阅读 · 0 评论 -
万能头文件#include<bits/stdc++.h>
#include包括几乎所有的c++头文件,but 国内有些oj还是不支持。去年hdu,poj等都是不支持的,however 哈哈哈今年hdu支持了这个万能头文件,亲测sdut也是支持的。but but but,poj知道现在还是不支持。还有用这个头文件的前提是选G++原创 2017-08-21 15:23:46 · 1006 阅读 · 0 评论 -
Convolution Layer
Convolution LayerTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 256000/256000 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0Problem DescriptionIn Convolutional原创 2017-08-21 10:37:12 · 467 阅读 · 0 评论 -
小小粉丝度度熊
小小粉丝度度熊Accepts: 378Submissions: 1494Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Problem Description度度熊喜欢着喵哈哈村的大明星——星星小姐。为什么度度熊会喜欢星星原创 2017-08-13 15:09:10 · 515 阅读 · 0 评论 -
度度熊的交易计划
度度熊的交易计划Accepts: 59Submissions: 276Time Limit: 12000/6000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Problem Description度度熊参与了喵哈哈村的商业大会,但是这次商业大会遇到了一个难题:原创 2017-08-13 15:08:34 · 371 阅读 · 0 评论 -
路径计数
路径计数Accepts: 2Submissions: 23Time Limit: 16000/8000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Problem Description一个包含四个点的完全图,可以在任意节点出发,可以在任意节点结束,给出每个点被经过原创 2017-08-13 15:07:29 · 805 阅读 · 0 评论 -
Factory
FactoryAccepts: 7Submissions: 31Time Limit: 20000/10000 MS (Java/Others)Memory Limit: 132768/132768 K (Java/Others)Problem Description我们将A省简化为由N个城市组成,某些城市之间存在双向道路,而且A省的原创 2017-08-13 15:06:20 · 539 阅读 · 0 评论 -
chess
ChessAccepts: 1468Submissions: 4003Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Problem Description車是中国象棋中的一种棋子,它能攻击同一行或同一列中没有其他棋子阻隔的棋原创 2017-08-13 15:05:33 · 701 阅读 · 5 评论 -
最少拦截系统
某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹.怎么办呢?多搞几套系统呗!你说说倒蛮容易,成本呢?成本是个大问题啊.所以俺就到这里来求救了,请帮助计算一下最少需要多少套拦截系统原创 2017-07-28 10:23:09 · 265 阅读 · 0 评论 -
The Designer
The DesignerTime Limit: 8000/4000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0Problem DescriptionNowadays, little haha原创 2017-08-19 17:14:41 · 513 阅读 · 0 评论 -
The Karting
The KartingTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0Problem DescriptionThe Karting championship原创 2017-08-19 17:14:13 · 410 阅读 · 0 评论 -
Palindrome Function
Palindrome FunctionTime Limit: 8000/4000 MS (Java/Others) Memory Limit: 256000/256000 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0Problem DescriptionAs we all know原创 2017-08-19 17:13:46 · 623 阅读 · 1 评论 -
Subsequence Count
Subsequence CountTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 256000/256000 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0Problem DescriptionGiven a binary原创 2017-08-19 17:13:22 · 581 阅读 · 0 评论 -
malloc函数
malloc即动态内存分配。头文件123#include 或者#include 返回值如果分配成功则返回指向被分配内存的指针(此存储区中的初始值不确定),否则返回空指针NULL。当内存不再使用时,应使用free()函数将内存块释放。函数原创 2017-08-07 10:31:26 · 306 阅读 · 0 评论 -
数学黑洞
数学黑洞Time Limit: 1500MS Memory Limit: 65536KBSubmit Statistic DiscussProblem Description任意一个4位自然数N(N不能是4个数字一样,如1111、2222、….9999是不可以的,N也不能是6174),将组成自然数N的4个数字重新排列,形成一个最大数和最小数,最大数和最小数相减,其差原创 2017-08-15 17:44:26 · 377 阅读 · 0 评论 -
继续XXX定律
当n为3时,我们在验证xxx定律的过程中会得到一个序列,3,5,8,4,2,1,将3称为关键数,5,8,4,2称为覆盖数。现在输入n个数字a[i],根据关键数与覆盖数的理论,我们只需要验证其中部分数就可以确定所有数满足xxx定律,输出输入的n个数中的关键数。如果其中有多个关键数的话按照其输入顺序的逆序输出。Input 输入数据包含多个用例,每个用例首先包含一个整数n,然后接下来一行有n原创 2017-08-25 16:12:28 · 586 阅读 · 0 评论 -
山东省第六届ACM省赛正题题集
Problem A. Nias and Tug-of-War Description Nias is fond of tug-of-war. One day, he organized a tug-of-war game and invited a group of friends to take part in. Nias will divide them into two groups. Th...原创 2018-04-16 21:18:03 · 453 阅读 · 0 评论 -
山东省第五届ACM省赛正赛题集
angry_birds_again_and_againTimeLimit: 2000 ms Memory Limit: 65536 KiB SubmitStatisticDiscussProblemDescriptionTheproblems called "Angry Birds" and "Angry Birds Again andAgain" has been solved by many ...原创 2018-04-16 21:15:49 · 562 阅读 · 0 评论 -
7-12 愿天下有情人都是失散多年的兄妹.
7-12 愿天下有情人都是失散多年的兄妹(25 分)呵呵。大家都知道五服以内不得通婚,即两个人最近的共同祖先如果在五代以内(即本人、父母、祖父母、曾祖父母、高祖父母)则不可通婚。本题就请你帮助一对有情人判断一下,他们究竟是否可以成婚?输入格式:输入第一行给出一个正整数N(2 ≤ N ≤104),随后N行,每行按以下格式给出一个人的信息:本人ID 性别 父亲ID 母亲ID其中ID是5位数字,...原创 2018-03-21 21:32:43 · 792 阅读 · 0 评论 -
poj分类
OJ上的一些水题(可用来练手和增加自信) (poj3299,poj2159,poj2739,poj1083,poj2262,poj1503,poj3006,poj2255,poj3094)初期:一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法.转载 2017-12-15 14:13:42 · 241 阅读 · 0 评论 -
Flip game
DescriptionFlip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the other one is black and each piece is lying转载 2017-11-17 15:01:03 · 758 阅读 · 0 评论 -
Vjudge
https://vjudge.net/contest#category=all&running=0&title=lyu&owner=原创 2017-10-14 10:13:32 · 6262 阅读 · 0 评论 -
half-consecutive(未AC)
The numbers 111,333,666,101010,151515,212121,282828,363636,454545 and ti=12i(i+1)t_i=\frac{1}{2}i(i+1)ti=21i(i+1), are called half-consecutive.For given NNN, find the s原创 2017-09-09 16:55:13 · 463 阅读 · 0 评论 -
A Cubic number and A Cubic Number
A Cubic number and A Cubic NumberTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0Problem DescriptionA原创 2017-09-17 15:15:01 · 329 阅读 · 0 评论 -
Coconut
Coconut is Captain Gangplank's favourite fruit. That is why he needs to drink coconut juice frombbb coconuts each day.On his next trip, he would pass through NNN citis.His trip would begin i原创 2017-09-09 16:58:06 · 611 阅读 · 0 评论 -
banana
Bananas are the favoured food of monkeys.In the forest, there is a Banana Company that provides bananas from different places.The company has two lists.The first list records the types of banana原创 2017-09-09 16:56:51 · 627 阅读 · 0 评论 -
Apple
#include//runtime error 除零错误 #include#includeusing namespace std;int main(){ int x0,y0,x1,y1,x2,y2,x3,y3; int x4,y4; double dis,r; int n; cin>>n; for(int i=0;i<n;i++) { cin>>x1>原创 2017-09-17 17:09:17 · 268 阅读 · 0 评论 -
Rightmost Digit
Given a positive integer N, you should output the most right digit of N^N.Input The input contains several test cases. The first line of the input is a single integer T which is the number of原创 2017-09-08 17:50:00 · 278 阅读 · 0 评论 -
IBM Minus One
You may have heard of the book '2001 - A Space Odyssey' by Arthur C. Clarke, or the film of the same name by Stanley Kubrick. In it a spaceship is sent from Earth to Saturn. The crew is put into stasi原创 2017-09-08 17:36:01 · 340 阅读 · 0 评论 -
CaoHaha's staff
CaoHaha's staffTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0Problem Description"You shall not pass!原创 2017-08-19 17:12:56 · 811 阅读 · 0 评论 -
A Secret
A SecretTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 256000/256000 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0Problem DescriptionToday is the birthday of原创 2017-08-19 17:12:24 · 771 阅读 · 2 评论 -
Friend-Graph
Friend-GraphTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3254 Accepted Submission(s): 523Problem DescriptionIt is well known原创 2017-08-19 17:11:39 · 754 阅读 · 4 评论 -
C语言实验——计算表达式
C语言实验——计算表达式Time Limit: 1000MS Memory Limit: 65536KB SubmitStatistic Discuss Problem Description计算下列表达式值: Input输入x和n的值,其中x为非负实数,n为正整数。 Output输出f(x,n),保留2位小数。 Example In原创 2017-07-18 14:57:30 · 549 阅读 · 0 评论 -
struct和typedef struct
struct和typedef struct分三块来讲述: 1 首先://注意在C和C++里不同 在C中定义一个结构体类型要用typedef: typedef struct Student { int a; }Stu; 于是在声明变量的时候就可:Stu stu1;(如果没有typedef就必须用struct Student s转载 2017-07-21 16:38:17 · 253 阅读 · 0 评论 -
完美的素数
完美的素数Time Limit: 1000MS Memory Limit: 65536KB SubmitStatistic Discuss Problem Description 素数又称质数。指一个大于1的自然数,除了1和此整数自身外,不能被其他自然数整除的数。我们定义:如果一个素数是完美的素数,当且仅当它的每一位数字之和也是一个素数。现在给你一个正原创 2017-07-18 11:22:34 · 1114 阅读 · 0 评论 -
打印金字塔
C语言实验——打印金字塔Time Limit: 1000MS Memory Limit: 65536KB SubmitStatistic Discuss Problem Description输入n值,打印下列形状的金字塔,其中n代表金字塔的层数。 Input输入只有一个正整数n。 Output打印金字塔图形,其中每个数字之间有一个空格。原创 2017-07-18 09:56:13 · 745 阅读 · 0 评论 -
矩阵旋转
1.矩阵的旋转: 矩阵的逆时针旋转基本有四种情况:0度90度180度270度,相当于顺向的90度90度旋转:列号变为行号(n - 行号 - 1)变成列号规律: a[i][j] = b[j][n - i - 1]180度旋转:(n - 行号 -1)变为行号(m- 列号 + 1)变为列号规律:a[i][j] = b[n转载 2017-07-21 11:49:18 · 951 阅读 · 0 评论 -
字母旋转方阵
字母旋转方阵Time Limit: 1000MS Memory Limit: 65536KB SubmitStatistic Discuss Problem Description给定两个整数M,N,生成一个M*N的矩阵,矩阵中元素取值为A至Z的26个字母中的一个,A在左上角,其余各数按顺时针方向旋转前进,依次递增放置,当超过26时又从A开始填充。例如,当M=5原创 2017-07-21 11:09:13 · 1127 阅读 · 0 评论 -
冒泡排序中数据交换的次数
听说过冒泡排序么?一种很暴力的排序方法。今天我们不希望你用它来排序,而是希望你能算出从小到大冒泡排序的过程中一共进行了多少次数据交换。Input输入数据的第一行为一个正整数 T ,表示有 T 组测试数据。接下来T行,每行第一个整数N, 然后有N个整数,无序。0Output输出共 T 行。每行一个整数,代表本行数据从小到大冒泡排序所进行的交换次数。Ex原创 2017-07-20 16:06:11 · 8222 阅读 · 1 评论