2018【比特杯】编程大赛

1. D

#include <cstdio>
#include <cstring>
#include <algorithm>
#include<iostream>
using namespace std;
typedef long long LL;
int main(){int a=10;int x=a++;printf("a=%d x=%d\n",a,x);//a=11,x=10return 0;
}

2.C

#include <cstdio>
#include <cstring>
#include <algorithm>
#include<iostream>
using namespace std;
typedef long long LL;
int main(){char acX[]="abcdefg";char acY[]={'a','b','c','d','e','f','g'};int lenx=strlen(acX);int leny=strlen(acY);printf("lenx=%d,leny=%d\n",lenx,leny);return 0;
}

3.指针:C

#include <cstdio>
#include <cstring>
#include <algorithm>
#include<iostream>
using namespace std;
typedef long long LL;
int main(){unsigned long pulArray[]={6,7,8,9,10};unsigned long *pulptr;pulptr=pulArray;*(pulptr+3)+=3;printf("%d,%d\n",*pulptr,*(pulptr+3));//6,12return 0;
}

4.联合体:A

#include <cstdio>
#include <cstring>
#include <algorithm>
#include<iostream>
using namespace std;
typedef long long LL;
int main(){union{short k;char i[2];}*s,a;s=&a;s->i[0]=0x39;s->i[1]=0x38;printf("%x\n",a.k);//3839return 0;
}

5.数据溢出:C

#include <cstdio>
#include <cstring>
#include <algorithm>
#include<iostream>
using namespace std;
typedef long long LL;
int main(){unsigned char a=200;unsigned char b=100;unsigned char c;c=a+b;printf("%d %d\n",a+b,c);//300,44//300-2^8=44return 0;
}

6.宏定义:B

#include <cstdio>
#include <cstring>
#include <algorithm>
#include<iostream>
using namespace std;
typedef long long LL;
#define SQUARE(x) x*x
#define SQUARE2(x)  (x)*(x)
int main(){//预处理:printf("%d\n",1+2*1+2);printf("%d\n",SQUARE(1+2));//5//预处理:printf("%d\n",(1+2)*(1+2));printf("%d\n",SQUARE2(1+2));//9return 0;
}

7.结构体:D

#include <cstdio>
#include <cstring>
#include <algorithm>
#include<iostream>
using namespace std;
typedef long long LL;
struct Test{int i;double d;char c;
};int main(){struct Test T;printf("%d\n",sizeof(T));//24return 0;
}

8.D

#include <cstdio>
#include <cstring>
#include <algorithm>
#include<iostream>
using namespace std;
typedef long long LL;
unsigned short *sum(unsigned char a,unsigned char b){unsigned short s=0;s=a+b;return &s;
}
int main(){unsigned short *p=NULL;unsigned char a=1,b=2;p=sum(a,b);printf("%u+%u=%u\n",a,b,*p);//1+2=3return 0;
}

填空题1

#include <cstdio>
#include <cstring>
#include <algorithm>
#include<iostream>
using namespace std;
typedef long long LL;int main(){char *pcColor="CSOFTX3000";char acColor[]="CSOFTX3000";printf("%d\n",strlen(pcColor));//10printf("%d\n",strlen(acColor));//10printf("%d\n",sizeof(pcColor));//4printf("%d\n",sizeof(acColor));//11,字符串结束标志'\0'return 0;
}

填空题2

#include <cstdio>
#include <cstring>
#include <algorithm>
#include<iostream>
using namespace std;
typedef long long LL;
unsigned short* pucCharArray[10][10];
typedef union unRec{unsigned long ullndex;unsigned short usLeve[7];unsigned char ucPos;
}REC_S;
int main(){REC_S stMax,*pstMax;printf("%d\n",sizeof(pucCharArray));//400printf("%d\n",sizeof(stMax));//16printf("%d\n",sizeof(pstMax));//4printf("%d\n",sizeof(*pstMax));//16return 0;
}

填空题3

#include <cstdio>
#include <cstring>
#include <algorithm>
#include<iostream>
using namespace std;
typedef long long LL;int main(){unsigned char puc[4];struct tagPIM{unsigned char ucPim1;unsigned char ucData0:1;unsigned char ucData1:2;unsigned char ucData2:3;}*pstPimData;pstPimData=(struct tagPIM*)puc;memset(puc,0,4);pstPimData->ucPim1=2;pstPimData->ucData0=3;pstPimData->ucData1=4;pstPimData->ucData2=5;printf("%02x %02x %02x %02x\n",puc[0],puc[1],puc[2],puc[3]);//02,29,00,00printf("%02d %02d %02d %02d\n",puc[0],puc[1],puc[2],puc[3]);return 0;
}

编程题1:

#include <cstdio>
#include <cstring>
#include <algorithm>
#include<iostream>
using namespace std;
typedef long long LL;
int fun(int a[],int n)//0~n-1
{int cnt=1;for(int i=1;i<n;i++){if(a[i]!=a[i-1]){a[cnt++]=a[i];}}for(int i=0;i<cnt;i++)printf("%d\n",a[i]);return cnt;
}
int main(){int a[]={1, 1, 2, 2, 3, 4, 5, 6, 6};printf("%d\n",fun(a,sizeof(a)/sizeof(a[0])));return 0;
}

编程题2:

#include <cstdio>
#include <cstring>
#include <algorithm>
#include<iostream>
using namespace std;
typedef long long LL;
int fun(int k,int a[],int n,int b[],int m)//0~n-1,0~m-1
{int tot=0;int i=0,j=0;while(i<n&&j<m){if(a[i]<b[j]){tot++;if(tot==k)  return a[i];i++;//c[tot++]=a[i],i++;}else{tot++;if(tot==k)  return b[j];j++;//c[tot++]=b[j],j++;}}while(i<n){//c[tot++]=a[i],i++;tot++;if(tot==k)  return a[i];i++;}while(j<m){//c[tot++]=b[j],j++;tot++;if(tot==k)  return b[j];j++;}
}
int main(){int a[]={1, 3, 5, 7, 9, 11, 13 };int b[]={ 2, 4, 6, 8, 10};printf("%d\n",fun(5,a,7,b,5));return 0;
}

编程题3

#include <cstdio>
#include <cstring>
#include <algorithm>
#include<iostream>
using namespace std;
typedef long long LL;
class Date
{
public:Date(int year=1900,int month=1,int day=1):_year(year),_month(month),_day(day){//检查如果输入参数是非法时间,初始化为1900-1-1if(CheckIsInvaildDate()){year=1900;month=1;day=1;}}Date(const Date& d):_year(d.year),_month(month),_day(day){}Date& operator =(const Date& d){if(this!=d){this._year=d._year;this._month=d._month;this._day=d._day;}return *this;}//检查时间是否有效bool CheckIsInvaildDate(){if(_year<1||(_month<1||_month>12)||(_day<1||_day>DateOfMonth(_year,_month)))return true;return false;}void Display(){cout<<_year<<"-"<<_month<<"-"<<_day<<endl<<endl;}};

2018【比特杯】编程大赛相关推荐

  1. 深访杨超越杯编程大赛发起人 还原硬核粉丝追星全过程

    欢迎关注"创事记"的微信订阅号:sinachuangshiji 文/石灿 来源:刺猬公社(ID:ciweigongshe) "大家加油,我要退群了,被老婆看到不好.&qu ...

  2. 杨超越杯编程大赛上热搜:不懂技术真不敢追星

    别惊讶!人工智能时代即将到来! https://edu.csdn.net/topic/ai30?utm_source=cxrs_bw 作为程序员,粉丝追星似乎与"麻烦"相挂钩.例如 ...

  3. 超越杯编程大赛前线报道

    一个月前发了篇 经过这一个月的组队.开发阶段,超越杯编程大赛正式进入了比赛投票阶段: 而我呢,成功报名之后,阴差阳错地变成了1号队伍--说前排围观,连座位都是第一排第一号的位置,你们来感受下: 编号纯 ...

  4. python编程大赛规则_如何评价「杨超越杯编程大赛」?

    我是一名大二在校生.之前在刷微博的时候,突然看到月芽们要举办第一届超越杯编程大赛,我顿时心头一震:现在追星不容易啊,没点技能都不敢出来混了.我就想着要拿什么项目去参加这次比赛,后来看到潘伟洲大佬招队员 ...

  5. 程序员追星如此硬核?杨超越杯编程大赛获奖项目大盘点!

    不久前,微博热搜火了一个让程序员们一脸懵逼的话题,那就是 #杨超越杯编程大赛#,硬核男粉的追星之路由此起航. 比赛从开始到完结,基本每一个比赛节点都出现在微博热搜,当追星遇上程序员,当饭圈遇上码农,跨 ...

  6. 硬核粉丝 | 清华双胞胎“YCY Dance Now”杀进超越杯编程大赛决赛

    作者 | Jane 出品 | AI科技大本营(id:rgznai100) 从"黄蓉 AI 换脸 杨幂"."首届杨超越编程大赛"."cxk 流量或打篮球 ...

  7. 杨超越杯编程大赛登上 GitHub,程序员为追星都开发了什么?

    上周,百度贴吧吧主一刀两断,在杨超越吧为自己的爱豆组织了第一届杨超越杯编程大赛,我们也从中看到了技术宅追星的火热.接下来,本文将为你揭晓程序员们追星过程中带来了哪些技术含量极高.脑洞极大的项目? 前段 ...

  8. 盘盘“杨超越杯编程大赛”中那些脑洞大开的项目

    作者:徐麟,某互联网公司数据分析狮,个人公众号数据森麟(id:shujusenlin) 前言 前段时间,笔者看到一则新闻,提到杨超越粉丝策划了一场"杨超越杯编程大赛", 题目是做任 ...

  9. 盘点“杨超越杯编程大赛”中那些脑洞大开的项目

    文/徐麟 前言 前段时间,笔者看到一则新闻,提到杨超越粉丝策划了一场"杨超越杯编程大赛", 题目是做任何与相关的游戏.网页.工具等.刚开始看到这则新闻,笔者以为又是一次博眼球的明星 ...

  10. 编程队伍队名_#杨超越杯编程大赛#-这次不拼运气,拼实力!

    不要惊讶,你没有看错,这次编程大赛的名字确实是叫杨超越杯,但是并不是杨超越组织的,事实的真相是杨超越的男粉组织了第一届杨超越杯编程大赛,现在已有200多名程序员报名参加,硬核男粉赶快行动起来吧! [比 ...

最新文章

  1. java操作mongodb基础(查询 排序 输出list)
  2. 嵌入式linux如何下载程序,Linux平台的下载程序-嵌入式系统-与非网
  3. Spring.NET 学习总结
  4. 游戏开发需要具备哪些技术_短视频 SDK 开发 (一) 开发一款短视频 SDK 需要具备哪些知识?...
  5. android开机自动开启zram,低内存配置  |  Android 开源项目  |  Android Open Source Project...
  6. 计算机调试员高级理论知识试卷,电子计算机设备调试员(高级)考核复习题—理论试题.doc...
  7. Revit2018找不到外部工具
  8. Linux加一存在路由没事吧,Linux 添加永久静态路由的方法
  9. linux安装jdk和tomcat7.0
  10. 项目工时估算PERT法
  11. 解决V-Rep接近传感器(距离传感器、超声波传感器、红外传感器)不能正常识别问题
  12. 基于同源策略的移动应用细粒度隐私保护技术
  13. 华为鸿蒙推送机型,华为鸿蒙系统开始推送,这15款机型可率先升级,有你的吗?...
  14. 北京8成楼盘降价促销 房价已下跌10%-15%
  15. afrog的安装与使用
  16. 使用vue-cli创建vue工程
  17. Qt按键值与Windows Virtual-Key Codes映射表
  18. TCMalloc解密
  19. 性能分析工具JProfile使用指导书-小羊的记录本
  20. 字符串的大小写转换(多种方式)

热门文章

  1. Lua语言教程2 ——【表(Table) 类型】
  2. 使用swoole进行消息推送通知,配合vb.net进行客户端开发一样爽[开发篇]
  3. 如何生成WebPart的部署文件(wsp文件)
  4. 关于SOA的四个基本观点 from MS
  5. 企业所得税汇算清缴系统服务器,【图解】汇算清缴风险控制本周五发布,操作流程这里全有!...
  6. python turtle调整画布宽高_turtle.screensize改变不了窗口大小?
  7. java怎么设置不同事件_activiti 全局流程监听ActivitiEventListener,实现监听不同类型事件,不需要在acitivit中配置任务监听,非常方便...
  8. 增量式pid调节方式有何优点_增量式PID的“假抗饱和”性
  9. java collection join_java – @ElementCollection @CollectionTable在一对多映射中
  10. IDEA好用的Servlet模板