- 博客(5)
- 收藏
- 关注
原创 【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 1941
原创 【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 1814
原创 【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 422
原创 【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 1172
原创 【C-研发】getchar()用法
1.从缓冲区读走一个字符,相当于清除缓冲区2.前面的scanf()在读取输入时会在缓冲区中留下一个字符'\n'(输入完s[i]的值后按回车键所致),所以如果不在此加一个getchar()把这个回车符取走的话,gets()就不会等待从键盘键入字符,而是会直接取走这个“无用的”回车符,从而导致读取有误3.getchar()是在输入缓冲区顺序读入一个字符(包括空格、回车和Ta
2016-08-28 22:10:31 598
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人