写在三月末尾

金三银四。跳槽是,实习亦然。

站在3月的末尾,我想写点东西。

我觉得自己的找实习经历,跟罗振宇的一个比喻很像。
最开始的时候,妈妈给我的两个衣服口袋里装满了大枣,我觉得枣很多,有的看着小,有的咬一口觉得不好,就把它们随手扔在地上。
慢慢的,我发现口袋里的枣越来越少。我开始细嚼慢咽,不敢轻易浪费。
到了最后,口袋里的枣没有了,我只能把地上扔着的,又重新捡了起来,而且比之前还要小心翼翼。


跟我哥聊天,说起现在的境遇,我哥没想到我找实习的过程这么惨,他说,那你出国这一年,得到的没有失去的多?毕竟在国内的话,能立马去实习,是一个很大的加分项。我想了一下这一年的得到与失去。结论是,不,还是得到的更多。异国他乡的那份深入到骨子里的孤独,是在国内很难想象的,这份对抗孤独的过程,我相信是人生的一笔巨大财富。

老李校长说,未曾深夜痛哭者,不足以语人生。真正对这句话感同身受,正是这几天辗转难眠的深夜。

最初,我以为我是可以进BAT的。 极度膨胀下,中小互联网一律不看。基础知识简单刷刷,编程题目也浮光掠影。

我看我的前半生,觉得罗子君真幸运,有贺涵给他打开一扇门,然后她进去就好。

我以为我缺的只是面试机会。

之后是不断被打脸的过程,coding总有bug,动态规划都不懂,简历也没有出彩的地方,内推石沉大海。

这时候我看《最强大脑》。清华安徽理科状元孙勇,被三位导师,包括两位同校师兄不看好,顶着巨大压力和委屈,解开了一道巨难的题目,实力翻盘。成功的那一刻,他背对舞台,抑制不住的抽泣。
王峰说,强者对决没有失误一说,失误只是一种能力不足。

我意识到今天为止,我不能靠运气走下去了,凭能力,六维能力,我通通不达标。看最强大脑,你才知道,牛人是什么样的。而你,处在什么水平。智力上,我只是个普通人,投入时间和精力,在同水平也处于中下。我唯一能做的,就是踏踏实实的看书,刷题,走稳。

网易一道笔试题,我一脸懵逼,实验室工程师志奇,看了一眼,给我发了一份他写的代码。
放在这里,激励自己,牛人很多,路还很长。



题目:
You have n problems. You have estimated the difficulty of the i-th one as integer ci. Now you want to prepare a problemset for a contest, using some of the problems you've made.

A problemset for the contest must consist of at least two problems. You think that the total difficulty of the problems of the contest must be at least l and at most r. Also, you think that the difference between difficulties of the easiest and the hardest of the chosen problems must be at least x.

Find the number of ways to choose a problemset for the contest.
Input

The first line contains four integers n, l, r, x (1 ≤ n ≤ 15, 1 ≤ l ≤ r ≤ 109, 1 ≤ x ≤ 106) — the number of problems you have, the minimum and maximum value of total difficulty of the problemset and the minimum difference in difficulty between the hardest problem in the pack and the easiest one, respectively.

The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 106) — the difficulty of each problem.
Output
Print the number of ways to choose a suitable problemset for the contest.

志奇的代码:

#include <iostream>
#include <stdio.h>
using namespace std;


int is_satisfied(int v[30], int state,int n, int l, int r, int x){
    int sum = 0;
    int min = 1 << 30;
    int max = -1;

    for(int i = 0; i < n; i++){
        if(state >> i & 0x1){
            sum += v[i];
            if(min > v[i]) min = v[i];
            if(max < v[i]) max = v[i];
        }
    }
    return sum >= l && sum <= r && (max-min) >= x;
}

int main(){
    int n, l, r, x;
    int v[30];
    while(scanf("%d %d %d %d", &n, &l, &r, &x) != EOF){
        for(int i = 0; i < n; i++){
            scanf("%d", &v[i]);
        }

        int count = 0;
        for(int s = 0; s < (1<<n); s++){
            count += is_satisfied(v, s, n, l, r, x);
        }
        printf("%d\n", count);
        
    }
    return 0;
}




我把手机里单曲循环的主题曲..从最强大脑,也许会落空,也许会普通 换成刘欢的从头再来,心若在,梦就在,只不过是从头再来。




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值