
c语言
文章平均质量分 81
破茧quant
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
实现二维数组排序
最近在研究粗糙集、遗传算法、人工神经网络。在遗传网络计算适应性分数上,需要建立索引,要对二维数组排序。刚刚开始还感觉无从下手,最后应用c++库函数qsort轻松解决。Ps:给大家推荐一个遗传算法和人工神经网络入门的书:《游戏编程中的人工智能技术》这门书里面关于神经网络和遗传算法的介绍,确实不错。#include #include #include using namespace原创 2017-10-13 14:22:30 · 782 阅读 · 0 评论 -
HDU 1164 Eddy's research I
http://acm.hdu.edu.cn/showproblem.php?pid=1164 Eddy's research ITime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K(Java/Others)Total Submission(s): 3255 Accepted Submission(s):1原创 2017-10-13 14:21:35 · 236 阅读 · 0 评论 -
HDU 1170 Balloon Comes!
http://acm.hdu.edu.cn/showproblem.php?pid=1170 Balloon Comes!Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K(Java/Others)Total Submission(s): 12972 Accepted Submission(s):459原创 2017-10-13 14:21:32 · 178 阅读 · 0 评论 -
HDU 1202 The calculation of GPA
http://acm.hdu.edu.cn/showproblem.php?pid=1202 The calculation of GPATime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K(Java/Others)Total Submission(s): 11025 Accepted Submission原创 2017-10-13 14:21:30 · 343 阅读 · 0 评论 -
HDU 1219 AC Me
http://acm.hdu.edu.cn/showproblem.php?pid=1219 AC MeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K(Java/Others)Total Submission(s): 6651 Accepted Submission(s):2982Problem原创 2017-10-13 14:21:27 · 238 阅读 · 0 评论 -
HDU 1234 开门人和关门人
http://acm.hdu.edu.cn/showproblem.php?pid=1234 开门人和关门人TimeLimit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K(Java/Others)Total Submission(s): 6587 Accepted Submission(s):3376Proble原创 2017-10-13 14:21:24 · 301 阅读 · 0 评论 -
HDU 1248 寒冰王座
http://acm.hdu.edu.cn/showproblem.php?pid=1248 寒冰王座Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K(Java/Others)Total Submission(s): 5501 Accepted Submission(s):2678Problem原创 2017-10-13 14:21:21 · 194 阅读 · 0 评论 -
HDU 1279 验证角谷猜想
http://acm.hdu.edu.cn/showproblem.php?pid=1279 验证角谷猜想Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K(Java/Others)Total Submission(s): 3030 Accepted Submission(s):1543Proble原创 2017-10-13 14:21:18 · 275 阅读 · 0 评论 -
HDU 1282 回文数猜想
http://acm.hdu.edu.cn/showproblem.php?pid=1282 回文数猜想Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K(Java/Others)Total Submission(s): 1963 Accepted Submission(s):1212Problem原创 2017-10-13 14:21:16 · 281 阅读 · 0 评论 -
HDU 1237 简单计算器
http://acm.hdu.edu.cn/showproblem.php?pid=1237 简单计算器TimeLimit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K(Java/Others)Total Submission(s): 7456 Accepted Submission(s):2401Problem原创 2017-10-13 14:21:13 · 791 阅读 · 0 评论 -
HDU 1283 最简单的计算机
http://acm.hdu.edu.cn/showproblem.php?pid=1283 最简单的计算机Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K(Java/Others)Total Submission(s): 2298 Accepted Submission(s):1351Probl原创 2017-10-13 14:21:10 · 228 阅读 · 0 评论 -
HDU 1303 Doubles
http://acm.hdu.edu.cn/showproblem.php?pid=1303 DoublesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K(Java/Others)Total Submission(s): 1964 Accepted Submission(s):1361Probl原创 2017-10-13 14:21:07 · 231 阅读 · 0 评论 -
HDU 1323 Perfection
http://acm.hdu.edu.cn/showproblem.php?pid=1323 PerfectionTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K(Java/Others)Total Submission(s): 830 Accepted Submission(s):504Prob原创 2017-10-13 14:21:04 · 209 阅读 · 0 评论 -
HDU 1326 Box of Bricks
http://acm.hdu.edu.cn/showproblem.php?pid=1326 Box of BricksTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K(Java/Others)Total Submission(s): 2113 Accepted Submission(s):978原创 2017-10-13 14:21:01 · 223 阅读 · 0 评论 -
HDU 1334 Perfect Cubes
http://acm.hdu.edu.cn/showproblem.php?pid=1334 Perfect CubesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K(Java/Others)Total Submission(s): 1027 Accepted Submission(s):433原创 2017-10-13 14:20:58 · 210 阅读 · 0 评论 -
HDU 1157 Who's in the Middle
http://acm.hdu.edu.cn/showproblem.php?pid=1157 Who's in the MiddleTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K(Java/Others)Total Submission(s): 4274 Accepted Submission(s):原创 2017-10-13 14:21:38 · 349 阅读 · 0 评论 -
关于C++ 除法丢失数据
今天做USACO题的时候,遇到了除法四舍五入的问题。C++真不好处理,最后在网上看源代码,发现一个很简答的解决办法: if(num!=0) test[j].ans+=money%num;即是说,先对储存答案的数组加上余数,之后在执行除法: test[j].ans+=money/num;其中test[j].ans和money都是int型变量。这样修改以后终于AC了。原创 2017-10-13 14:21:43 · 595 阅读 · 0 评论 -
USACO transform
#include #include using namespace std;struct PP{ char a; bool v;};bool fun11(PP a[][100],int);bool fun12(PP a[][100],int);bool fun13(PP a[][100],int);bool fun2(PP a[][100],int);bool fun3(PP原创 2017-10-13 14:21:46 · 208 阅读 · 0 评论 -
c++重载运算符
#includeusing namespace std;classfun //复数加法 减法 乘法 除法的类(函数重载){public: fun() {real=0;imag=0;} fun(double r,double i) { real=r; imag=i; } friend fun operator +(fun &,fun&); friend fu原创 2017-10-13 14:22:27 · 490 阅读 · 0 评论 -
计算带括号的数值表达式
题目:输入一串数值算术表达式( 如:34+5-(8+4)*6 ) ,计算机编程实现对该表达式的树形存储(即:去除括号),并输出表达式的结构树和相应的前缀表达式和后缀表达式,以及完成求值运算。算法:共分为5个文件,4个头文件,一个主函数.“jiedian.h” #includeusing namespace std;const int MAX=100;//最大节点数c原创 2017-10-13 14:22:24 · 2679 阅读 · 0 评论 -
狼找兔子问题
题目:狼找兔子问题:一座山周围有n个洞,顺时针编号为0,1,2,3,4,…,n-1。一只狼从0号洞开始,顺时针方向计数,每当经过第m个洞时,就进洞找兔子。输入m,n。试问兔子有没有幸免的机会?如果有该藏在哪儿?算法:#include#includeusing namespace std;bool a[9999999];int main(){i原创 2017-10-13 14:22:21 · 5561 阅读 · 0 评论 -
给出5个数字,前4个数字做四则运算…
#include#includeusing namespace std;char fuhao[4]={'+','-','*','/'};bool caculate(int f[3],double shuzi[5]);int main(){ int i,j,k; double shuzi[5]; int f[3]; while(1) { cout bool flag=原创 2017-10-13 14:22:18 · 724 阅读 · 0 评论 -
哈夫曼算法
#includeusing namespace std;//Haffman树的创建//给出几个字母,以及相应出现频率或者是频数,程序计算给出Haffman编码struct Haffman//构造节点结构{bool ifvalue;//该节点是否对应输入的字母char s;//如果是输入字母的节点,s保存字母,否则置空int num;//保存节点权值bool gen;//是否是根结原创 2017-10-13 14:22:15 · 575 阅读 · 0 评论 -
二分法求解方程解
求解sin(x)=9*x*x-1 x在规定精度下的解#include#includeusing namespace std;double JD=0.00001;//精度初始化double save;//用于判断是否达到精度要求int num_count;//用来保存二分次数double fun(double left,double right)//当x取0时,sinx=9*x*x-1原创 2017-10-13 14:22:13 · 1319 阅读 · 0 评论 -
C语言一个简单的贪吃蛇程序
这是很早以前写的.好像还是有问题,"食物"的出现有可能跟墙壁重叠,懒得改啦#include#include#include#include#includeusing namespace std;const int HALL=20;const int LEVEL=300;const char T='#';char hall[HALL][HALL]={' '};//墙壁bool原创 2017-10-13 14:22:10 · 1695 阅读 · 0 评论 -
Prime Palindromes
分析:能力有限,最后一组数据总是超时,没办法。。只好猥琐一下了。。。代码如下:#include #include #include using namespace std;int p[10000]={5,7,11,101,131,151,181,191,313,353,373,383,727, 757,787,797,919,929,10301,10501,10601,11311,1原创 2017-10-13 14:22:07 · 639 阅读 · 0 评论 -
_variant_t to Cstring 的转换
CString CMFCDataBaseDlg::VariantToCString(_variant_t var){CString str; //转换以后的字符串switch(var.vt){case VT_BSTR: //var is BSTR typestr=var.bstrVal;break;case VT_I2: //var is short int原创 2017-10-13 14:22:04 · 268 阅读 · 0 评论 -
Mother's Milk
http://ace.delos.com/usacoprob2?a=apdOY9i86bK&S=milk3分析:每次只有六种选择,可以用递归。代码如下:#include #include #include #include #include using namespace std;int A,B,C;void DFS(int,int,int);bool tong[22][2原创 2017-10-13 14:22:01 · 873 阅读 · 0 评论 -
Arithmetic Progressions
http://ace.delos.com/usacoprob2?a=ypoaBnzumP9&S=ariprog分析:这题就是暴力搜索,剪枝,加了一个条件以后就过了。。没有再探寻更优解法。代码如下:#include #include #include #include #include using namespace std;struct PP{ int a; int b;原创 2017-10-13 14:21:58 · 345 阅读 · 0 评论 -
usaco The Clocks
没想到好方法,9个循环……#include #include #include int ans[4][4]={0};int a[10];int tr[4][4]={0};bool check();void move(int,int);void movehelp(int a[][4],int,int);using namespace std;int main(){ ifs原创 2017-10-13 14:21:55 · 239 阅读 · 0 评论 -
usaco Prime Cryptarithm
PrimeCryptarithmThe following cryptarithm is a multiplication problem that canbe solved by substituting digits from a specified set of N digitsinto the positions marked with *. If the set of prime原创 2017-10-13 14:21:52 · 297 阅读 · 0 评论 -
Barn Repair
分析:可以想象只用一个木板,这样需要一个长度x,然后计算每两个相邻牛之间的空隙长度,排序。然后需要几个木板就减去相应的空隙长度(从大到小依次减) #include #include #include #include using namespace std;bool ans[201];struct PP{ int x; int y; int len;};int cm原创 2017-10-13 14:21:49 · 192 阅读 · 0 评论 -
HDU 1391 Number Steps
http://acm.hdu.edu.cn/showproblem.php?pid=1391 Number StepsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K(Java/Others)Total Submission(s): 2014 Accepted Submission(s):1277原创 2017-10-13 14:20:50 · 207 阅读 · 0 评论 -
HDU 1491 Octorber 21st
http://acm.hdu.edu.cn/showproblem.php?pid=1491 Octorber 21stTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K(Java/Others)Total Submission(s): 1234 Accepted Submission(s):815原创 2017-10-13 14:20:41 · 198 阅读 · 0 评论 -
HDU 1555 How many days?
http://acm.hdu.edu.cn/showproblem.php?pid=1555 How many days?TimeLimit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K(Java/Others)Total Submission(s): 2783 Accepted Submission(s):1649原创 2017-10-13 14:20:39 · 184 阅读 · 0 评论 -
HDU 2115 I Love This Game
http://acm.hdu.edu.cn/showproblem.php?pid=2115 I Love This GameTimeLimit: 3000/1000 MS(Java/Others) MemoryLimit: 32768/32768 K (Java/Others)Total Submission(s):2968 AcceptedSubmission(s原创 2017-10-13 14:19:38 · 285 阅读 · 0 评论 -
HDU 2135 Rolling table
http://acm.hdu.edu.cn/showproblem.php?pid=2135 Rolling tableTime Limit: 3000/1000 MS(Java/Others) MemoryLimit: 32768/32768 K (Java/Others)Total Submission(s):1000 AcceptedSubmission(s):原创 2017-10-13 14:19:32 · 205 阅读 · 0 评论 -
HDU 2136 Largest prime factor
http://acm.hdu.edu.cn/showproblem.php?pid=2136 Largest prime factorTime Limit: 5000/1000 MS(Java/Others) MemoryLimit: 32768/32768 K (Java/Others)Total Submission(s):2815 AcceptedSubmiss原创 2017-10-13 14:19:29 · 198 阅读 · 0 评论 -
HDU 2137 circumgyrate the string
http://acm.hdu.edu.cn/showproblem.php?pid=2137 circumgyrate the stringTime Limit: 10000/1000 MS(Java/Others) MemoryLimit: 32768/32768 K (Java/Others)Total Submission(s):2164 AcceptedSub原创 2017-10-13 14:19:26 · 249 阅读 · 0 评论 -
HDU 2153 仙人球的残影
http://acm.hdu.edu.cn/showproblem.php?pid=2153 仙人球的残影Time Limit: 2000/1000 MS(Java/Others) MemoryLimit: 32768/32768 K (Java/Others)Total Submission(s):2898 AcceptedSubmission(s): 1210原创 2017-10-13 14:19:23 · 262 阅读 · 0 评论