编程
文章平均质量分 50
编程题、算法题等,主打语言是C、C++
2096498443
学习技术的菜鸟。
展开
-
杨辉
#include <iostream>#include <stdio.h>#include <algorithm>#include <string>#include <cstring>#include <cctype>using nam原创 2019-03-16 18:16:43 · 200 阅读 · 0 评论 -
特殊回文数
特殊回文数 #include <iostream>#include <stdio.h>#include <algorithm>#include <string>#include <cstring>#include <cctype>using namespace std; const double PI=3....原创 2019-03-16 17:57:56 · 112 阅读 · 0 评论 -
十六进制转八进制
蓝桥杯基础练习 十六进制转八进制时间限制:1.0s 内存限制:512.0MB问题描述 给定n个十六进制正整数,输出它们对应的八进制数。输入格式 输入的第一行为一个正整数n (1<=n<=10)。 接下来n行,每行一个由09、大写字母AF组成的字符串,表示要转换的十六进制正整数,每个十六进制数长度不超过100000。输出格式 输出n行,每行为输入对应的八进制...原创 2019-03-16 17:05:00 · 235 阅读 · 0 评论 -
指针传递的情况
在论坛里经常见到一些新人对指针提出一些问题,作为一个经历过许多错误后的新手,我想把自己的经历说出来,避免让后来人继续这样的错误。 在讲解指针之前,需要理解一下内存空间。内存是随机存取器,计算机上电后便利用内存进行运转。其有一定的容量,为了标识每个存储单元的位置,我们为内存设置了内存地址。内存的具体组织结构可以参考计算机组成原理。 指针是一种指向某种类型的特殊的型别。一般用*定义。如...转载 2018-11-04 22:55:21 · 347 阅读 · 0 评论 -
打印菱形的神奇方法(简短)
A BCD CDEFG DEFGH I J CDEFG BCD A #include <stdio.h>#include <string.h>#include <ctype.h>#include <stdlib.h>#include <...原创 2018-01-01 17:14:30 · 404 阅读 · 0 评论 -
并查集
#include <cstdio>#include <iostream>#include <string>using namespace std;const int maxn=1000+10;int n,m,x,y;int pre[maxn];int Find(int x){ if(pre[x]<0 ) return x; retu...原创 2018-05-14 23:19:39 · 103 阅读 · 0 评论 -
King of Karaoke
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4025题目连接、很巧妙地一个题目题意:就是给你两个整数数列,ai和bi,a序列加上一个常数,问和b序列相同位置上的数相同的数最大有多少个?解:用bi-ai求众数当有很多的差值相等时证明加上一个常数能够使他们相等#include <cstdio>#include ...原创 2018-05-11 20:33:05 · 465 阅读 · 0 评论 -
uva 10881 蚂蚁
#include <iostream>#include <cstdio>#include <algorithm>using namespace std;const int maxn=10000+10;struct Ant{ int id;int pos;int dire;// -1 左 0 转身中 1 右 bool operat...原创 2018-05-02 19:32:11 · 133 阅读 · 0 评论 -
UVA 墓地雕塑
#include <cstdio>#include <iostream>#include <cstring>#include <cstdlib>#include <algorithm>#include <cmath>using namespace std;const int maxn=1000000+10;in...原创 2018-05-01 22:02:07 · 141 阅读 · 0 评论 -
C - Rain Water trapping
Sai Charanis a professional programmer such that whatever he finds interesting, he would immediately convert it into a problem and try to get an algorithm for it which is the stepping stone for solvi...原创 2019-06-02 21:01:17 · 109 阅读 · 0 评论 -
H - Equations
Consider equations having the following form:a*x1^2+b*x2^2+c*x3^2+d*x4^2=0a, b, c, d are integers from the interval [-50,50] and any of them cannot be 0.It is consider a solution a system ( x1,x...原创 2019-06-01 00:30:57 · 254 阅读 · 0 评论 -
Stall Reservations
Oh those picky N (1 <= N <= 50,000) cows! They are so picky that each one will only be milked over some precise time interval A..B (1 <= A <= B <= 1,000,000), which includes both times...原创 2019-05-20 22:51:13 · 179 阅读 · 0 评论 -
逆序对
给定一个1-N的排列A1, A2, ... AN,如果Ai和Aj满足i < j且Ai > Aj,我们就称(Ai, Aj)是一个逆序对。 求A1, A2 ... AN中所有逆序对的数目。 Input第一行包含一个整数N。 第二行包含N个两两不同整数A1, A2, ... AN。(1 <= Ai <= N) 对于60%的数据 1 <= N &l...原创 2019-05-21 15:48:59 · 177 阅读 · 0 评论 -
Division
Write a program that finds and displays all pairs of 5-digit numbers that between them use the digits 0through 9 once each, such that the first number divided by the second is equal to an integer N,...原创 2019-05-21 18:25:50 · 133 阅读 · 0 评论 -
全排列+素数环(回溯)
参考链接:全排列+素数环全排列#include <iostream>#include <set>#include <cstdio>#include <map>#include <cstring>#include <cstdio>#include <cctype>#include <q...原创 2019-05-26 16:58:49 · 160 阅读 · 0 评论 -
D - Unique Snowflakes
题意:给出 n个数,找到尽量长的一个序列,使得该序列中没有重复的元素这里给出思路:给出代码:#include <iostream>#include <set>#include <cstdio>#include <map>#include <cstring>#include <cstdio>#inc...原创 2019-05-30 17:18:52 · 201 阅读 · 2 评论 -
F - Max Sum (动态规划+数学推导证明)
F - Max SumGiven a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 + 4 = ...原创 2019-05-30 19:19:27 · 485 阅读 · 0 评论 -
法里数列--uva
#include <iostream>#include <set>#include <cstdio>#include <map>#include <cstring>#include <cstdio>#include <cctype>#include <queue>#include &l...原创 2019-05-28 19:49:29 · 90 阅读 · 0 评论 -
Saruman's Army
参考#include <iostream>#include <set>#include <cstdio>#include <map>#include <cstring>#include <cstdio>#include <cctype>#include <queue>#includ...原创 2019-05-28 20:41:47 · 117 阅读 · 0 评论 -
Parencodings
Let S = s1 s2 ... s2n be a well-formed string of parentheses. S can be encoded in two different ways:By an integer sequence P = p1 p2 ... pn where pi is the number of left parentheses before the ith...原创 2019-05-19 20:33:12 · 85 阅读 · 0 评论