码迷,mamicode.com
首页 >  
搜索关键字:visaul stdio    ( 10042个结果
c语言基础-回文数复习
#include<stdio.h>intmain(void){intsum=0,val,m;printf("请输入一个随机整数:");scanf("%d",&val);m=val;while(m){sum=sum*10+m%10;//(理解举例:m==123,sum==3*10^2+2*10^1+3*10^0)m/=10;}if(sum==val){printf("%d是回文数",val);}else{printf("%d不是回文数",va..
分类:编程语言   时间:2014-11-06 02:12:07    阅读次数:147
生成者消费者(线程同步,互斥,条件变量)
#include #include "stdio.h"#include #include #define N_CONSUMER 3 //消费者数量#define N_PRODUCER 2 //生产者数量#define C_SLEEP 1 //控制 consumer 消费的节奏#define P_SL...
分类:编程语言   时间:2014-11-05 21:06:30    阅读次数:204
C语言字符串比较(转)
#include char s1[10],s2[10]; ... if(strcmp(s1,s2)==0) printf("两字符串相等\n"); string.h 头文件中就有比较函数,可以用来比较是否相等2:这个是普通方法 不调用函数strcmp();#include &lt;stdio.h&g...
分类:编程语言   时间:2014-11-05 19:33:02    阅读次数:237
超大数相加C语言程序设计
#include<stdio.h> #include<string.h> intmain(intargc,constchar*argv[]){ charone[100],two[100],sum[100]; inttemp=0,lenth,lenthTwo,i,lenthOfSum; scanf("%s",one); getchar();//读取回车字符 scanf("%s",two); lenthTwo=(int)strlen(two); if(strlen(t..
分类:编程语言   时间:2014-11-05 15:02:57    阅读次数:200
HDU 4770 DFS&状压
一个n*m的房间有的房间是可破坏的,其他不可破坏,现在给你一些L型的灯,其中只有一个可以旋转,其他不能,让你用最少的灯覆盖所有的可破坏区域,且不能覆盖不可破坏的区域。 枚举旋转的灯,对剩下的DFS即可,状压存储已经被点亮的灯 #include "stdio.h" #include "string.h" struct P { int x,y; }p[21]; int ans,n,m,...
分类:其他好文   时间:2014-11-05 14:56:50    阅读次数:171
HDU 4771 BFS&状压 水
n*m矩阵,起点@,从矩阵中拿k个物品的最小代价 水BFS #include "stdio.h" #include "string.h" #include "queue" using namespace std; int b[]={1,2,4,8,16}; int dir[4][2]={{1,0},{-1,0},{0,1},{0,-1}}; struct node { i...
分类:其他好文   时间:2014-11-05 10:53:34    阅读次数:165
递归与迭代
头文件#include<stdlib.h> #include<stdio.h> #include<string.h> #pragmaonce代码文件#include"myH.h" //深度理解递归与迭代方法 //递归与迭代方法的区别: //递归使用函数和条件语句(if和else语句) //迭代法使用循环语句(for和while语句) /***************..
分类:其他好文   时间:2014-11-05 00:34:20    阅读次数:176
c语言字符串_续
第一篇文章http://www.cnblogs.com/bluewelkin/p/4063265.html续篇如下例一:统计字母的个数(忽略大小写,有空格也可继续统计字母,直到\n结束,但空格未统计)#include"stdio.h"main(){int a[100]={0},i,j; char c...
分类:编程语言   时间:2014-11-04 18:58:45    阅读次数:228
HDU 1243 DP
思路和1080一样 题目有几个坑: 范围要开到2010,题目没有给 子弹数量和恐怖分子出现的字符串长度不一定相等 用memset会超时 #include "stdio.h" #include "string.h" int dp[2010][2010],a[2010]; int Max(int a,int b,int c) { int...
分类:其他好文   时间:2014-11-04 11:06:16    阅读次数:163
hdu 1244 DP
水DP  dp[i%2][j]=Max(dp[i%2][j-1],dp[1-i%2][j-l[i]]+sum[j]-sum[j-l[i]]); #include "stdio.h" #include "string.h" int Max(int a,int b) { if (a<b) return b; else return a; } int dp[2][1010...
分类:其他好文   时间:2014-11-04 11:04:20    阅读次数:169
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!