![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
WXC^_^
这个作者很懒,什么都没留下…
展开
-
算法竞赛入门经典(第2版)例题(第3章)
例题 3-1 TeX中的引号(Tex Quotes)#include<stdio.h>int main(){ int c, q = 1; while((c = getchar()) != EOF) { if (c == '"') { printf("%s", q ? "“" : "”"); q = !q; } else printf("%c", c); } return 0;} 例题 3-2 WERTYU#include<stdi原创 2020-11-27 23:27:44 · 143 阅读 · 0 评论 -
算法竞赛入门经典(第2版)程序(第3章)
程序3-1 逆序输出#include<stdio.h>#define maxn 105int a[maxn];int main(){ int x, n = 0; while(scanf("%d", &x) == 1) //ctrl+z结束 a[n++] = x; for (int i = n-1; i >= 1; i--) printf("%d ", a[i]); printf("%d\n", a[0]); return 0;}程序3-2 开原创 2020-11-23 21:59:56 · 141 阅读 · 0 评论 -
算法竞赛入门经典(第2版)习题(第2章)
习题2-1 水仙花数(daffodil)#include<stdio.h>int main(){ for(int i = 100; i <= 999; i++) { int a = i/100; int b = i/10%10; int c = i%10; if (a*a*a + b*b*b + c*c*c == i) printf("%d\n", i); } return 0;}习题2-2 韩信点兵(hanxin)#include<std原创 2020-11-17 01:18:19 · 126 阅读 · 0 评论 -
算法竞赛入门经典(第2版)习题(第1章)
习题1-2 温度(temperature)#include<stdio.h>int main(){ double f, c; scanf("%lf", &f); c = 5.0*(f-32)/9.0; printf("%.3f", c); return 0;}习题1-4 正弦和余弦(sin和cos)#include<stdio.h>#include<math.h>int main(){ const double pi = acos(原创 2020-11-17 00:41:54 · 191 阅读 · 0 评论