搜狐畅游2020校招笔试 - 游戏开发工程师(C )
时长:120分钟 总分:100分
76浏览 0人已完成答题
题型介绍
题型 | 单选题 | 多选题 | 填空题 |
---|---|---|---|
数量 | 45 | 10 | 2 |
2016年3月,AlphaGo对战世界围棋冠军,职业九段选手李世石,并且以...
下面代码的输出结果是什么?#include <stdio....
#include <stdio.h>
void main()
{
const char* s1 = "0123456789"
char s2[] = "0123456789"
char s3[100] = "0123456789"
char s4[100]
char* s5 = s3
printf("%d, %d, %d, %d, %d\n", sizeof(s1), sizeof(s2), sizeof(s3), sizeof(s4), sizeof(s5))
}
下面代码的输出结果是什么?#include <stdio....
#include <stdio.h>
void main()
{
int x = 10
int y = 10
int z = 10
for (z = 0 x > 8 y = z++)
{
printf("%d,%d,", x--, y)
}
}
以下两种情况:(1) new 1个长度为10的整型的数...
(1) new 1个长度为10的整型的数组。
(1) 分10次 new 一个长度为1的整型的数组。
哪个占用系统的空间更多些?
以下输出的结果是#include <iostream>...
#include <iostream>
#pragma pack(2)
struct S1
{
S1() { f = 0 s = 0 i = 0 c = 0 }
float f
short s
int i
char c
}
#pragma pack(push)
#pragma pack(16)
struct S2
{
S2() { d = 0 c = 0 i = 0 }
double d
S1 s1
char c
int i
}
#pragma pack(pop)
int main()
{
std::cout << sizeof(S2) << std::endl
}
#include <iostream>#includ...
#include <cstring>
class Base {
public:
virtual void f() { std::cout << "Base::" << i << std::endl }
void clear() { memset(this, 0, sizeof(Base)) }
int i
}
class Derive: public Base {
public:
void f() {
std::cout << "Derive::" << i << std::endl
}
}
int main() {
Base* p = new Derive()
p->i = 2019
p->clear()
p->f()
delete p
return 0
}
有如下程序:执行后的输出结果应该是:#include class...
#include
class BASE{
public:
~BASE(){cout<<"BASE";}
};
class DERIVED: public BASE{
public:
~DERIVED(){cout<<"DERIVED";}
};
void main(){DERIVED x;}
有如下一段程序: int f1(float); int f2(char);...
int f1(float);
int f2(char);
int f3(float);
int f4(float);
int(*pf)(float);
则以下不合法的是:
有如下说明语句int a[10]={1,2,3,4,5,6,7,...
有如下模板定义:template T fun(T&nb...
template T fun(T x,T y){return x*x+y*y;}
在下列对fun的调用中,错误的是:
如下程序输出的结果是#define MAX(a, b)...
#define MAX(a, b) ((a) > (b) ? a : b )
int main()
{
int a = 5, b = 0
int c = MAX(++a, b)
int d = MAX(++a, b + 10)
printf("%d %d %d %d\n", a, b, c, d)
return 0
}
有如下程序:执行后的输出结果应该是:#includeclass ...
#include
class cla{
static int n;
public:
cla(){n++;}
~cla(){n--;}
static int get_n(){return n;}
};
int cla::n=0;
int main()
{
cla * p=new cla;
delete p;
cout<<"n="<<cla::get_n()<<endl;
return 0;
}
执行如下程序后的输出结果是:#includeclass test...
#include
class test{
static int count;
public:
test(){count++;}
~test(){count--;}
static int getCount(){return count;}
};
int test::count=0;
int main()
{
test * p=new test;
test * q=new test;
delete p;
cout<<"count="<<test::getCount()<<endl;
return 0;
}
若有定义:char *str[] = {&q...
则可以表示出字符't'的表达式是
设有以下定义: int a[3][4] = {1, 2, 3, 4, 5,...
int a[3][4] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
int (*ptr)[4] = a, *p = a[0]
则下列表达式中,能正确表示数组元素a[2][1]的表达式有
在一个单链表结构中,指针p指向链表的倒数第二结点,指针s指向新结点,则能将...
棋盘
我们此刻想通过若干次移动,将所有棋子最后摆成一个彼此靠近的水平线,这样他们最后的坐标就是(X, Y), (X+1, Y), ....., (X+N, Y)。水平线上的棋子最后的顺序以及整数X和Y都是任意的。
我们的问题是求完成这样的目标,最少需要移动几步。
注意:任何时候同一个格子内都不可以同时放两个或两个以上的棋子(棋子不可堆叠)。
输入描述: 输入文件一共有n+1行。
第1行为一个正整数n,1<=n<10000, n为棋子的数量。
从第2行开始一直到n+1行,一共n行,分别描述的是n个棋子各自的初始位置。每一行均为用空格分开的两个整数x[i], y[i], 他们表示第i个棋子的坐标,-10000<=x[i],y[i]<=10000。输入样例: 3 1 0 2 4 3 2 输出描述: 输出仅有1行,它的值为将棋子移动到目标位置所需的最少步数。输出样例 4
大整数
一个十进制整数N,一共有m位,m满足1<=m<=80。
请设计一个程序,对于给定的某一个整数N,找到满足3k+k^2+k^3<=N的k的最大值。输入描述: 输入数据是一个m位的整数N,行末无多余空格输入样例: 20000000000000000000344444444499988888888888888888881 输出描述: 输出为所找到的k最大值,行末无多余空格输出样例 271441761659490656