
C语言
eatingyan
前后端研发人员--熟悉前后端框架,微信小程序等快速入门的东西,目前在努力学习各大框架源码。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【C-研发】algorithm用法
#include 中sort的一般用1、sort函数的时间复杂度为n*log2(n),执行效率较高。2、sort函数的形式为sort(first,end,method)//其中第三个参数可选。3、若为两个参数,则sort的排序默认是从小到大,见如下例子 #include#includeusing namespace std;int main(){int a[10]=原创 2016-08-28 22:15:52 · 2038 阅读 · 0 评论 -
【C-算法题】The Old Key古老的密码之解
#include#include#include#define MAX 100+10int comp(const void *a,const void *b){return *(int *)a-*(int *)b;}int main(){char s1[MAX],s2[MAX];int cnt1[26],cnt2[26];while(scan原创 2016-07-25 15:02:53 · 1061 阅读 · 0 评论 -
【C-研发】getchar()用法
1.从缓冲区读走一个字符,相当于清除缓冲区2.前面的scanf()在读取输入时会在缓冲区中留下一个字符'\n'(输入完s[i]的值后按回车键所致),所以如果不在此加一个getchar()把这个回车符取走的话,gets()就不会等待从键盘键入字符,而是会直接取走这个“无用的”回车符,从而导致读取有误3.getchar()是在输入缓冲区顺序读入一个字符(包括空格、回车和Ta原创 2016-08-28 22:10:31 · 650 阅读 · 0 评论 -
【C-研发】strchr用法
#include#includeint main(){int count=0;char s[20],but[99];scanf("%s",&s);for(int abc=111;abcfor(int de=11;de{int x=abc*(de%10),y=abc*(de/10),z=abc*de;sprintf(but,"%d%d%d%d%d",abc原创 2016-08-28 22:11:55 · 1249 阅读 · 0 评论 -
【C-算法题】丑数
#include#include#include#includeusing namespace std;typedef long long LL;const int coeff[3]={2,3,5};int main(){priority_queue,greater >pq;sets;pq.push(1);s.insert(1);for(int原创 2016-08-28 22:13:10 · 464 阅读 · 0 评论 -
【C-算法题】switch off light
#include#include#define MAX 1010int a[MAX];int main(){int n,k,first=1;memset(a,0,sizeof(a));scanf("%d%d",&n,&k);for(int i=1;ifor(int j=1;jif(j%i==0) a[j]=!a[j];for(int i=1;原创 2016-08-28 22:14:03 · 1939 阅读 · 0 评论