08 2016 档案

摘要:数据结构与算法系列 目录 冒泡排序 冒泡排序介绍 冒泡排序(Bubble Sort),又被称为气泡排序或泡沫排序。 它是一种较简单的排序算法。它会遍历若干次要排序的数列,每次遍历时,它都会从前往后依次的比较相邻两个数的大小;如果前者比后者大,则交换它们的位置。这样,一次遍历之后,最大的元素就在数列的 阅读全文
posted @ 2016-08-25 16:13 A-inspire 阅读(266) 评论(0) 推荐(0)
摘要:#include <iostream> #include <opencv2/opencv.hpp> using namespace cv; using namespace std; int main() { Mat input_image; VideoCapture cam(0); if (!cam 阅读全文
posted @ 2016-08-24 17:08 A-inspire 阅读(2085) 评论(0) 推荐(0)
摘要:研路 2016/8/7 22:35 好久没有更新了,最近也过得不怎么样。暑假以来,似乎生活有些颠倒,没有什么规律性,严格来讲是有点颓废。 今天终于好一点点了。这个假期一直在考虑和决定考研,身心疲劳。因为连自己都不知道是否应该选择这条路,实话讲,如果够坚定,或者是有一个足够的理由支撑着可能就不会那么纠 阅读全文
posted @ 2016-08-07 23:40 A-inspire 阅读(480) 评论(1) 推荐(0)
摘要:#include #include using namespace std; int main() { //-1 没人赢 0:O赢 1:X赢 int size; printf("0表示“甲方”,1表示“乙方”\n\n"); printf("请输入矩阵的大小\n"); while (scanf("%d", &size) == 1) { int board[100][100]; int num_o... 阅读全文
posted @ 2016-08-07 17:46 A-inspire 阅读(997) 评论(0) 推荐(0)
摘要:描述:简单题 问题描述 给定n个整数表示一个商店连续n天的销售量。如果某天之前销售量在增长,而后一天销售量减少,则称这一天为折点,反过来如果之前销售量减少而后一天销售量增长,也称这一天为折点。其他的天都不是折点。如下图中,第3天和第6天是折点。 给定n个整数a1, a2, …, an表示销售量,请计 阅读全文
posted @ 2016-08-06 20:08 A-inspire 阅读(1474) 评论(0) 推荐(0)
摘要:这道题目非常简单! 问题描述 有 N 个非零且各不相同的整数。请你编一个程序求出它们中有多少对相反数(a 和 -a 为一对相反数)。 输入格式 第一行包含一个正整数 N。(1 ≤ N ≤ 500)。 第二行为 N 个用单个空格隔开的非零整数,每个数的绝对值不超过1000,保证这些整数各不相同。 输出 阅读全文
posted @ 2016-08-06 19:39 A-inspire 阅读(657) 评论(0) 推荐(0)
摘要:#include<iostream>#include<algorithm>using namespace std;struct node //定义结构体{ int num;//数据 int count;//出现的次数 计数};bool cmp(node a, node b)//排序{ if (a.c 阅读全文
posted @ 2016-08-06 19:26 A-inspire 阅读(1195) 评论(0) 推荐(0)
摘要:#include <stdio.h> #define MAXN 64 int a[MAXN + 1][MAXN + 1] = { 0 }; void gamecal(int k, int n)//处理编号k开始的n个选手的日程 { int i, j; if (n == 2) { a[k][1] = 阅读全文
posted @ 2016-08-06 14:43 A-inspire 阅读(190) 评论(0) 推荐(0)
摘要:#include <stdio.h>#include <windows.h>#include<string.h>int main() { int oldprice, price = 0, i = 0; printf("请首先设置商品的真实价格:"); scanf("%d", &oldprice); 阅读全文
posted @ 2016-08-06 01:21 A-inspire 阅读(263) 评论(0) 推荐(0)
摘要:#include<stdio.h>int main(){ int num1, num2,temp; scanf("%d%d",&num1,&num2); int t1 = num1; int t2 = num2; while (num2 != 0) { temp = num1%num2; num1 阅读全文
posted @ 2016-08-03 19:06 A-inspire 阅读(246) 评论(0) 推荐(0)
摘要:#include<stdio.h>int main(){ int one,tow,five,num=1; for (one = 1; one < num*10; one++) { for (tow = 1; tow < num*10 / 2; tow++) { for (five = 1; five 阅读全文
posted @ 2016-08-03 18:50 A-inspire 阅读(1662) 评论(0) 推荐(0)
摘要:#include<stdio.h>#include<stdlib.h>#include<time.h>int main(){ int i; for(i=1;i<=5;i++) { printf("i=%d\n",i); }printf("i最后的值为%d\n",i);return 0;}/* for 阅读全文
posted @ 2016-08-02 17:47 A-inspire 阅读(159) 评论(0) 推荐(0)
摘要:#include<stdio.h>#include<stdlib.h>#include<time.h>int main(){ int num,i,result=1; scanf("%d",&num); for(i=1;i<=num;i++) { result=result*i; } printf(" 阅读全文
posted @ 2016-08-02 17:33 A-inspire 阅读(265) 评论(0) 推荐(0)
摘要:#include<stdio.h>#include<stdlib.h>#include<time.h>int main(){ srand(time(0)); int ich;int num; do { getchar(); num=rand()%100+1; if(num%6==0) { print 阅读全文
posted @ 2016-08-02 17:14 A-inspire 阅读(253) 评论(0) 推荐(0)
摘要:#include<stdio.h>#include<stdlib.h>#include<time.h>int main(){ srand(time(0)); int count=0,thought; int num=rand()%100+1; printf("%d\n",num); do { pri 阅读全文
posted @ 2016-08-02 16:53 A-inspire 阅读(283) 评论(0) 推荐(0)
摘要:#include<stdio.h>int main(){int num,count=0,i=0,ret=0;scanf("%d",&num);while(num>=0){ printf("%d\n",num); num--;} return 0;}/*32 1 0 -1 num--; printf( 阅读全文
posted @ 2016-08-02 16:27 A-inspire 阅读(1050) 评论(0) 推荐(0)
摘要:#include<stdio.h>int main(){int num,count=0,i=0,ret=0;scanf("%d",&num);count=num;while(num>1){ num/=2; ret++;}printf("log2 of %d = %d\n",count,ret); r 阅读全文
posted @ 2016-08-02 16:13 A-inspire 阅读(4418) 评论(0) 推荐(0)
摘要:#include<stdio.h>int main(){int num,count=0,i=0;scanf("%d",&num);printf("num++=%d\n",num++);printf("num=%d\n",num);printf("++num=%d\n",++num);printf(" 阅读全文
posted @ 2016-08-02 15:44 A-inspire 阅读(160) 评论(0) 推荐(0)
摘要:#include<stdio.h>int main(){int num,count=0,i=0;scanf("%d",&num);num/=10;count++;while(num>0){ num/=10; count++;}printf("%d\n",count);return 0;}//注意:在 阅读全文
posted @ 2016-08-02 15:32 A-inspire 阅读(1571) 评论(0) 推荐(0)
摘要:#include<stdio.h>int main(){int score,grade;scanf("%d",&score);grade=score/10;switch (grade){case 10:case 9: printf("A\n"); break;case 8: printf("B\n" 阅读全文
posted @ 2016-08-02 15:14 A-inspire 阅读(1521) 评论(0) 推荐(0)
摘要:#include<stdio.h>int main(){int num;int a,b,c,result,d,result1;scanf("int%d",&num);//scanf 的东西必须是要输入的: 内容!!!a=num/100;b=num%10;c=num%100/10;d=num/10%1 阅读全文
posted @ 2016-08-02 14:34 A-inspire 阅读(232) 评论(0) 推荐(0)
摘要:#include<stdio.h>int main(){int num;int a,b,c,result,d,result1;scanf("%d",&num);a=num/100;b=num%10;c=num%100/10;d=num/10%10;printf("%d %d %d\n",a,b,c) 阅读全文
posted @ 2016-08-02 14:28 A-inspire 阅读(2356) 评论(0) 推荐(0)
摘要:#include<stdio.h>/*void change(int m,int n){ int t; t=m; m=n; n=t;}*/int main(){//交换两杯水,需要一个空杯子,临时保存作用int a=5;int b=6;int t;//scanf("%d%d",&a,&b);t=a; 阅读全文
posted @ 2016-08-02 14:06 A-inspire 阅读(491) 评论(0) 推荐(0)
摘要:#include<stdio.h> int main(){printf("请分别输入身高的英尺和英寸," "如输入\"5 7\"表示5英尺7英寸:\n");int foot;double inch;scanf("%d %lf",&foot,&inch);printf("身高是%f米。\n",((fo 阅读全文
posted @ 2016-08-02 13:41 A-inspire 阅读(219) 评论(0) 推荐(0)