
c语言
iteye_5145
这个作者很懒,什么都没留下…
展开
-
桶排序
圆桶排序下面是代码: #includeint main(){ int a[11],i,j,n,t; for(i=0;i原创 2015-11-09 23:25:22 · 81 阅读 · 0 评论 -
求两个正整数的最大公约数和最小公倍数并拓展到n个正整数
输入两个正整数m和n求其最大公约数和最小公倍数 用辗转相除法进行求解#includeint main(){ int m,n,r,p,t; while(~scanf("%d %d",&n,&m))//输入多组值 { p=m*n;//科普:n个数的乘积与他们的最小公约数和最大公倍数的值相等 if(n>m)//将简答...原创 2015-11-10 08:46:19 · 211 阅读 · 0 评论 -
冒泡排序
冒泡排序代码#include#define N 100int a[N];//定义一位数组a[N]int main(){ int i,n,j,t; while(~scanf("%d",&n))//可输入多组数据 { printf("请输入n个整数\n"); for(i=0;i...原创 2015-11-10 14:02:23 · 82 阅读 · 0 评论 -
快速排序
快速排序的效率较冒泡排序的较高我也不是真的非常理解,我就把我的想法写下来吧。下面是代码,我会根据我的理解进行注释~#includeint a[101],n;int quicksort(int left ,int right){ int i,j,t,temp; temp=a[left];//将最左边的作为基准数 i=left; j=ri...原创 2015-11-11 22:33:21 · 81 阅读 · 0 评论 -
简单的找因子问题
#includeint main(){ int n,i; scanf("%d",&n); for(i=1;i原创 2015-11-16 08:57:08 · 1014 阅读 · 0 评论 -
杭电 1018
Problem DescriptionIn many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryption, etc. In this problem you are ...原创 2015-11-17 09:00:24 · 213 阅读 · 0 评论 -
杭电2199-----二分法
#include#includedouble cha(double x){ return 8*pow(x,4) + 7*pow(x,3) + 2*pow(x,2) + 3*x + 6;}int main(){ int t; double left,right,mid; scanf("%d",&t); int y; ...原创 2015-11-18 20:45:34 · 136 阅读 · 0 评论 -
杭电---2141
Problem DescriptionGive you three sequences of numbers A, B, C, then we give you a number X. Now you need to calculate if you can find the three numbers Ai, Bj, Ck, which satisfy the formula Ai+...原创 2015-11-20 19:30:30 · 127 阅读 · 0 评论 -
杭电--2899 三分法
#include#include#include#include#includeusing namespace std;double cal(double x,double y){ return 6*pow(x,7)+8*pow(x,6)+7*pow(x,3)+5*pow(x,2)-y*x ;}int main(){ int t;...原创 2015-11-20 19:35:35 · 142 阅读 · 0 评论