
C++
文章平均质量分 63
Tiger-Su
可爱
展开
-
C++的求5个数中的最小和最大
#include #include #include //sort函数的头文件 using namespace std; int main() { int a[5],i; //从键盘中输入5个数 for(i=0;i { scanf("%d",&a[i]); } //用sort函数将5个数从原创 2013-07-10 22:08:34 · 3028 阅读 · 0 评论 -
树的高度
#include #include #include int Adjmatrix[25][25]; int visited[25]; int x,y; int ok=0; int max=1; void DFS(int location,int count) { if(count==x) { if(location==x)ok=1;原创 2014-03-15 22:23:13 · 605 阅读 · 0 评论 -
1111:最高分是多少
#include #include #include #include #include using namespace std; int b[100008]; void lcs(char s1[],int a1,int a2) { int max=0; int h=a1; if(s1[0]=='Q') { for(;h if(b[h]>max)原创 2014-03-10 10:19:59 · 747 阅读 · 0 评论 -
N的N次方最左边的数
#include #include int main() { int n; while((scanf("%d",&n))!=EOF) { double a,c; int b,d; a=n*log10(n); b=(int)a; c=a-b; d=(int)(pow(10,c)); printf("%d\n",d); } }原创 2014-03-01 09:55:12 · 1826 阅读 · 0 评论 -
有进位和没进位
#include #include #include #include using namespace std; //大数相加 void dashu(char s1[],char s2[]){ int a[25]={0},b[25]={0},l1,l2,c,k,i; l1=strlen(s1); l2=strlen(s2); if(l1原创 2014-02-25 19:52:37 · 1119 阅读 · 0 评论 -
南阳oj第8题一种排序
#include #include #include #include using namespace std; typedef struct{ int a,b,c; }s; bool cmp(s s1,s s2){ if(s1.a if(s1.a==s2.a&&s1.b if(s1.a==s2.a&&s1.b==s2.b&&s1.c return false;原创 2014-02-24 21:03:35 · 702 阅读 · 0 评论 -
括号配对问题
南阳理工括号配对问题,已经AC的了。 这是我的代码。 #include #include char str[10001]={0}; int i=0; void chack(int k,char s2){ if((s2==']'&&str[k-1]=='[')||(s2==')'&&str[k-1]=='(')){ str[k-1]=0; i=i-1; }原创 2013-12-20 11:19:28 · 479 阅读 · 0 评论 -
知道年月日就可以计算那一天是星期几(What day is today?)
公式 W =〔 [c/4] - 2c + y + [y/4] + [13 * (m+1) / 5] + d - 1 〕% 7 (或者是:w= 〔y+[y/4]+[c/4]-2c+[26(m+1)/10]+d-1 〕% 7) 若要计算的日期是在1582年10月4日或之前,公式则为 w=y+[y/4]+[c/4]-2c+[13(m+1)/5]+d+2 以1572年9月3日为例: 1572年转载 2013-12-19 10:53:52 · 2990 阅读 · 0 评论 -
油田合并
#include using namespace std; char s[55][55]; int map[55][55]; int n,m,many; int dfs(int i,int j){ map[i][j]=1; if(i+1 dfs(i+1,j); if(j+1 dfs(i,j+1); if(i-1>=0&&s[i+1][j]=='翻译 2013-12-17 20:39:28 · 1053 阅读 · 0 评论 -
2013年广东ACM“有为杯”k题答案
这是根据我自己的想法写的算法,请各位品评品评 #include #include using namespace std; #define g 100000 //结构体 typedef struct { char ak[g]; int b; }ss; ss chuan[100000]; //遍历s字符串是否符合k字符串的要求 int chack(char原创 2013-09-01 22:25:46 · 604 阅读 · 0 评论 -
数据结构(C语言版)数制转换,用栈来实现十进制换成八进制的数
数据结构(C语言版)数制转换,用栈来实现十进制换成八进制的数。请各位品评品评。 #define stack_size 100 #define strack_ent 10 #define TRUE 1 #define FALSE 0 #define ERROR 0 #define OVERFLOW -2 #include using namespace std; typedef原创 2013-09-01 22:32:18 · 9473 阅读 · 0 评论 -
数据结构(C语言版)page49 3.22括号匹配的检验——用栈来实现
数据结构(C语言版)page49 3.22括号匹配的检验——用栈来实现。请各位品评品评。 #include #define stack_size 100 #define stackent 10 using namespace std; typedef struct{ char *top; char *base; int stacksize; }sqstack;原创 2013-09-01 22:29:01 · 1390 阅读 · 0 评论 -
求字符串的长度 串联接函数 串联接函数
#include #include #include #include using namespace std; int chack(int a[],int b[]) { int i=0; int *p=a,*q=b; for(;*p!='\0';*p++) { if(原创 2013-07-20 11:20:55 · 914 阅读 · 0 评论 -
这个是用指针实现的将数组a中的n个整数按相反顺序存放
这个是用指针实现的将数组a中的n个整数按相反顺序存放 下面是我的见解,请各位品评、品评 #define N 4 //宏定义 #include // 输入输出头文件 using namespace std; //分配运行内存空间 void main() { void insert(int *p,int n); // 声明方法 int a[N]; fo原创 2013-07-14 20:27:35 · 4180 阅读 · 0 评论 -
将数组a中的n个整数按相反的顺序存放
将数组a中的n个整数按相反的顺序存放 这是我的理解,请各位品评 #define N 4 //宏定义 #include // C++数组的标准输入的头文件 using namespace std; //为工程分配空间 void main() { void insert(int x[],int n); 声明方法 int a[N]; //循环输原创 2013-07-14 19:54:13 · 3230 阅读 · 0 评论 -
c语言的数组、指针、函数传递释义
c语言的数组、指针、函数传递释义 c语言的数组、指针、函数传递释义 by一月说C 这是个很经典的问题,学C的人可能都会有这个迷茫阶段吧,本人将对这个问题的理解,花了几天时间整理如下,希望大家给予指正。同时也希望能对初学者有所帮助。不过还是声明下本文只代表本人观点。 第一,变量。变量定义时为其指定了一个存储单元(也就是在存储地址)。也就是说一个变量对应一个存储单元。如int a=1,b,转载 2013-07-11 16:49:38 · 1347 阅读 · 0 评论 -
来源:2013年浙江大学复试机试模拟题
********************************* * 日期:2013-3-23 * 作者:SJF0115 * 题号: 题目1531: One Day Tour In ZJU * 来源:http://acmclub.com/problem.php?id=1531 * 结果:AC * 来源:2013年浙江大学复试机试模拟题 *转载 2014-03-15 21:35:43 · 559 阅读 · 0 评论