2015年网易公司校招笔试编程+3轮面试

测试工程师技术笔试--两道编程题

1.递归思想


#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <stack>
#include <cctype>
#include <vector>
#include <cmath>
#include <map>

#define ll long long

using namespace std;

ll ans;
ll i;
ll n;

int main()
{
    int T;
    scanf("%d",&T);
    //for(int ccnt=1;ccnt<=T;ccnt++){
    while(scanf("%lld",&n) != EOF) {
        n--;
        i=1;
        ans=1;
        //printf(" i=%I64d n=%I64d ans=%I64d\n",i,n,ans);
        while(n>=i+1)
        {
            n=n-i-1;
            ans+=i-1;
            i++;
            //printf(" i=%I64d n=%I64d ans=%I64d\n",i,n,ans);
        }
        ans+=n;
        printf("%lld\n",ans);
    }
    return 0;
}
2,建模

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 100;
int n, m, k, a[N][N], vis[N][N];
int main() {
    while (cin >> n >> m >> k) {
        memset(a, 0, sizeof(a));
        for (int i = 1; i <= k; ++i) {
            int x, y;
            cin >> x >> y;
            a[x][y]++;
        }
        int ans = 0;
        for (int x1 = 1; x1 <= n - 2; ++x1) {
            for (int y1 = 1; y1 <= m - 2; ++y1) {
                for (int x2 = 1; x2 <= n - 2; ++x2) {
                    for (int y2 = 1; y2 <= m - 2; ++y2) {
                        memset(vis, 0, sizeof(vis));
                        int cur = 0;
                        for (int ix = x1; ix <= x1 + 2; ++ix) {
                            for (int iy = y1; iy <= y1 + 2; ++iy) {
                                vis[ix][iy] = 1;
                                cur += a[ix][iy];
                            }
                        }
                        for (int ix = x2; ix <= x2 + 2; ++ix) {
                            for (int iy = y2; iy <= y2 + 2; ++iy) {
                                if (!vis[ix][iy]) {
                                    cur += a[ix][iy];
                                }
                            }
                        }
                        ans = max(ans, cur);
                    }
                }
             }
        }
        cout << ans << endl;
    }
    return 0;
}

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

面试环节:

一面:

索引   二级索引查找  c++实现

shell  查找含义日期的log文件  并 删除

游标 的定义 书写

二面:

智力题:

怎么较准确的称量人的头的重量

A  B 两个小岛各有一人 , B上的人生病了,A上的人有药,AB之间有船,C这个人管理,但他喜欢偷东西,现在AB各有一个钥匙和锁,每人只能开自己的锁,问怎么把药送给B.

HR面:

吹吹牛,聊聊天


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值