![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
基础算法
小小暮雨
这个作者很懒,什么都没留下…
展开
-
产生9个互不相同的随机数
闲来无事,写下这产生随机数的程序。说是简单,耗掉我这种菜鸟几天的时间,终于完成。思路很简单,就是:产生一个1—9的随机数,与之前已经存在的比较,看是否重复,不重复则保存,否则重新长生一个随机数。原创 2014-08-17 14:18:04 · 2140 阅读 · 0 评论 -
南阳理工oj88--汉诺塔(一)
题目链接。http://acm.nyist.net/JudgeOnline/problem.php?pid=88#include /*//测试一下49999和50000,1000000,1000000000你会发现规律.//关键是9个0的那个超大数输出的必须要快,否则超时.*/int nunu(int a){ int i; int m=1; //a原创 2015-11-26 20:15:52 · 812 阅读 · 0 评论 -
杭电ACM1170--Balloon Comes!
地址 http://acm.hdu.edu.cn/showproblem.php?pid=1170#includeint main(){ int t,a,b; char m[2]; scanf("%d",&t); while(t--) { scanf("%s%d%d",m,&a,&b); if(m[0原创 2015-11-22 10:38:30 · 1472 阅读 · 0 评论 -
杭电ACM2011-- 多项式求和
题目地址 :多项式求和/*#includeint main(){ int n,b; double a[110],x; double z; int i,j; int f; for (i=1;i<101;i++) a[i]=(double)1/(double)i; scanf("%d",&n); while(n--) { scanf原创 2015-11-22 10:33:02 · 2557 阅读 · 0 评论 -
杭电ACM2080--夹角有多大II
http://acm.hdu.edu.cn/showproblem.php?pid=2080/*//Author:nunu//#include #include #include #include int main(void){ int n; double x[2], y[2], t; scanf("%d", &n); w原创 2015-10-28 19:44:16 · 1449 阅读 · 0 评论 -
杭电ACM2092--整数解
做ACM不只只是AC了。还要更深入的了解。原创 2015-02-09 21:03:44 · 2532 阅读 · 0 评论 -
杭电ACM2061--Treasure the new start, freshmen!
ACM是每天要做的事,每一个AC都是一个小小的欣慰。原创 2015-02-04 15:19:56 · 920 阅读 · 0 评论 -
杭电ACM2091--空心三角形
http://acm.hdu.edu.cn/showproblem.php?pid=2091 scanf 和 printf的输入输出功能并不强大。有时候我们需要清空输入输出流,所以一定切记getchar()的使用。#include int main(){ char a; int i,j,k=0,n; scanf("%c",&a); while (a!='@') { s原创 2015-01-27 15:40:02 · 1763 阅读 · 0 评论 -
杭电ACM2098--分拆素数和
题目:http://acm.hdu.edu.cn/showproblem.php?pid=2098 这是源码。其实我本不想拿出源码,毕竟源码很容易被复制。我这里刚开始出错的地方有0_0_12811458_22064.cpp0_0_12811458_22064.cpp(9) : error C2668: “sqrt” : 对重载函数的调用不明确 \include原创 2015-01-26 17:20:41 · 1459 阅读 · 0 评论 -
杭电2034——人见人爱A-B
每天AC一题。原创 2015-01-08 10:34:01 · 1244 阅读 · 0 评论 -
杭电ACM2097--Sky数
这题思路很简单,把10,12,16进制数都按位相加,然后进行比较即可。http://acm.hdu.edu.cn/showproblem.php?pid=2097 #include int peng(int m){ int a; a = m/1000+(m%1000)/100+(m%100)/10+m%10; return a;}int peng16(int m){原创 2015-01-26 18:08:47 · 1353 阅读 · 0 评论 -
杭电ACM2096--小明A+B
http://acm.hdu.edu.cn/showproblem.php?pid=2096本来就是很简单。但是数据的大小有要求。(a%100+b%100)%100和(a+b)%100本来没有什么区别,但是int型的数据类型是有范围的,所以必须严格按照要求来写。#include int main(){ int a,b; int t; scanf("%d",&t); whil原创 2015-01-26 18:21:21 · 1717 阅读 · 0 评论 -
将string转换成char*
string 是c++标准库里面其中一个,封装了对字符串的操作 把string转换为char* 有3中方法: 1.data 如: string str="abc"; char*p=str.data(); 2.c_str 如:string str="gdfd"; const char*p=str.c_str(); 3.copy比如 string原创 2014-10-05 16:40:30 · 3535 阅读 · 1 评论 -
杭电2014——青年歌手大奖赛_评委会打分
C语言的基础啊原创 2014-11-18 20:42:46 · 760 阅读 · 0 评论 -
nyoj_t218(Dinner)
求各位大神指出错误的原因。小弟感激不尽。原创 2014-10-06 09:12:19 · 669 阅读 · 0 评论 -
nyoj---t448(寻找最大数)
ACM的亲友们,大家一起努力吧。原创 2014-10-06 17:05:53 · 978 阅读 · 0 评论 -
郑州轻工业OJ1400--这不可能是情书吧
地址:http://acm.zzuli.edu.cn/problem.php?id=1400#include#include#includestruct stu{ char a[110]; int b[110];}st;/*void bubble(stu st,int n) //定义两个参数:数组首地址与数组大小{ int i,j,t; char temp;原创 2015-12-07 20:54:13 · 1767 阅读 · 0 评论