美团2016研发工程师笔试题(三)
时长:90分钟 总分:100分
116浏览 0人已完成答题
题型介绍
题型 | 单选题 |
---|---|
数量 | 30 |
求最少需要的奖品总数,以满足上述规则?
下面程序输出结果为?
#include<iostream.h> #define SUB(X,Y) (X)*Y int main(){ int a=3,b=4 cout<<SUB(a++,++b) return 0 }
在int p[][4]={{1},{3,2},{4,5,6},{0}}中,p[1][2]的值是()
int p[][4] = {{1}, {3, 2}, {4, 5, 6}, {0}}中,p[1][2]的值是()
代码运行结果是?
#include<iostream> #include<string> using namespace std class A { friend long fun(A s) { if (s.x<3) { return 1 } return s.x+fun(A(s.x - 1)) } public: A(long a) { x = a-- } private: long x } int main() { int sum=0 for( int i=0 i<5 i++) { sum += fun(A(i)) } cout<<sum }
运行结果是?
#include <iostream> using namespace std int f(int n){ if (n==1) return 1 else return (f(n-1)+n*n*n) } int main(){ int s=f(3) cout<<s<<endl return 0 }
关于以下程序代码的说明正确的是()
public class HasStatic {// 1 private static int x = 100// 2 public static void main(String args[]) {// 3 HasStatic hsl = new HasStatic()// 4 hsl.x++// 5 HasStatic hs2 = new HasStatic()// 6 hs2.x++// 7 hsl = new HasStatic()// 8 hsl.x++// 9 HasStatic.x--// 10 System.out.println(" x=" + x)// 11 } }
程序运行后的输出结果是?
#include<iostream> #include<stdio.h> using namespace std int main(){ int m=0123, n = 123 printf("%o %o\n", m, n) return 0 }
用二进制来编码字符串"adceadaa",需要能够相据编码,解码回原来的字符串,则至少需要二进制字符的长度是?
有以下程序运行结果为:
#include <iostream> using namespace std char fun(char x, char y) { if (x < y) return x return y } int main() { int a = '1', b = '1', c = '2' cout << fun(fun(a, b), fun(b, c)) return 0 }
下面程序的运行结果是?
public static void main(String args[]) { Thread t=new Thread(){ public void run(){ dianping() } } t.run() System.out.print("dazhong") } static void dianping(){ System.out.print("dianping") }