现发布【刘汝佳《算法竞赛入门经典》(第二版)——紫书】的例题和习题的代码和详细解释。 欢迎批评指正! 另外欢迎关注本人微信公众号——程序员Yukyin 【第三章 数组和字符串】 【例题】 例题3-1 TeX中的...
现发布【刘汝佳《算法竞赛入门经典》(第二版)——紫书】的例题和习题的代码和详细解释。 欢迎批评指正! 另外欢迎关注本人微信公众号——程序员Yukyin 【第三章 数组和字符串】 【例题】 例题3-1 TeX中的...
习题2-3倒三角形 这道题一开始畏难,感觉自己做不出来,但是逼自己一把还是出来了嘛 一开始做错是错在了忘了数组下标从0开始,从1开始计算三角形就多了好多。 #include<stdio.h> int main(){ int n...
标签: ACM
这篇博客是对《算法竞赛入门经典》第二版的习题总结。其中一二章是基础中的基础,省去。 题目网址 文章目录一、数组和字符串 一、数组和字符串 习题 知识点 难度 解题报告 3-2开灯问题 使用a[i] = !a[i]...
GitHub - jzplp/aoapc-UVA-Answer: 算法竞赛入门经典 例题和习题答案 刘汝佳 第二版 AC代码 #include<stdio.h> #include<algorithm> #include<vector> using namespace std; int main() { ...
都是《算法竞赛入门经典(第二版)》的题目,标题上没写(第二版)题目:算法竞赛入门经典 3-7/UVa1368:DNA Consensus String 代码://UVa1368 - DNA Consensus String #include using namespace std;#define
UVA-12108 特别困的学生 题解答案代码
《算法竞赛入门经典(第2版)》是一本算法竞赛的入门与提高教材,把C/C++语言、算法和解题有机地结合在一起,淡化理论,注重学习方法和实践技巧。全书内容分为12 章,包括程序设计入门、循环结构程序设计、数组和...
《算法竞赛入门经典:训练指南》题目多选自近年来ACM/ICPC区域赛和总决赛真题,内容全面,信息量大,覆盖了常见算法竞赛中的大多数细分知识点。书中还给出了所有重要的经典算法的完整程序,以及重要例题的核心代码,...
算法竞赛入门经典第二版 课后习题3-2 分子量 # include &amp;lt;iostream&amp;gt; # include &amp;lt;memory.h&amp;gt; using namespace std; int main() { int x; cin&amp;gt;&amp;gt;x...
int main() { double a, b; int count = 0; int c[100] ; double Case[100] ; while (cin >> a >> b >> c[count]&&a!=0&&b!=0&&c!=0) { Case[count] = a/b; count++; }
习题1-1 平均数(average) #include #include using namespace std; int main() { int a,b,c; scanf("%d %d %d",&a,&b,&c); printf("%.3lf",( a+b+c )/3.0 );...习题1-2 温度(temperature) #inclu
标签: 算法
#include int main(void) { int n, m, kase = 0; float sum = 0.0; while(scanf("%d %d", &n, &m) != EOF && (n||m)) { for(int i = n; i sum += 1.0 / i / i; //当i>46340时,i*i数值将会大于int...
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO代码:(Accepted,0 ms)//UVa815 - Flooded! #include #include int M, N, W, S[1000], T = 0; int main() { //freopen("in.txt", "r", stdin); w
题意:一堆文件但只有一个打印机,按优先级与排队顺序进行打印。也就是在一个可以插队的的队列里,问你何时可以打印到。至于这个插队啊,题目说”Of course, those annoying term papers that others are printing ...
题意:有若干交换生、若干学校,有人希望从A校到B校,有的想从B到C、C到A等等等等。如果有人想从A到B也刚好有人想从B到A,那么可以交换(不允许一对多、多对一)。看作后如果有人找不到人交换,那么整个交换计划失败...
本题的难点在于精确到小数点后c位,按照手算的方法可以解决这个题目,具体代码如下,需要注意的地方已经写了注释。 #include<stdio.h> int main(){ int a,b,c,t,kase=0; while(3==scanf("%d %d %d",&...
一开始套刘汝佳大整数类的板子套出好多问题,之后自己用string重新封装了一个。 用大整数类求出斐波那契数列然后将前42位插入字典树,便于之后查找前缀。这题做出了灵异事件,在自己机器上预处理好几分钟都跑不完...
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 代码:(Accepted,0 ms)//UVa12108 - Extraordinarily Tired Students #include struct how_cute_my_sleepy_boys_are { int a,//awaken period : a>=1;
本人非常崇拜 Steve Jobs
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO代码:(Accepted,0 ms)//UVa1593 - Alignment of Code #include #include #include #include #include #include #in
p34 编程记录
链接源地址:https://code.google.com/archive/p/aoapc-book/
这题因为格式问题,提交了7次,都是PE,后来看了别人的代码,修改了格式通过的#include #include #define maxn 90 char su[maxn]; char bi[maxn]; int main() { int t; scanf("%d",&t);... //pri
目前已知的排序算法的数量,反正想数清楚的话用手指头肯定是不够的,其实脚趾头加上也不够。首先求出最小的数,然后求出最大的数,再然后求出中间的那个数(怎么求?不过排序问题解决的是任意数量的数的排序问题。...
http://acm.hust.edu.cn/vjudge/contest/123676#problem/B 密码5201 #include #include #include #include using namespace std;...//freopen("C:\\Users\\5201\\Desktop\\1.txt","r",stdin)
标签: 算法
java实现分支程序的设计 鸡兔同笼 题干:已知鸡和兔的总数量是n,总的腿数为m,输入m和n,输出鸡的数量,兔的数量,如果无解输出No answer...设鸡有a只,兔有b只,则a+b = n,a*2+b*4 = m,联立解的a = (4*n-m)/2,b = n-a.
书上具体所有题目:...代码:(Accepted,0 ms)//UVa509 - RAID! #include int d, s, b, t, times = 0; char disk_data[7][6666], type;inline char* disk(int x, int y, int z) {//二维数组当
书上具体所有题目:...代码:(Accepted,0 ms)#include unsigned N, A, B, Sp, Sq, ansA, ansB; unsigned long long Pofs, K, nowK; int main() { //freopen("in.txt", "r", stdin);