题目还没放出来,等更新。堆头文件习惯,别见怪。

A题:找规律

注意结果开long long

#include <fstream>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <math.h>
#include <bitset>
#include <algorithm>
#include <climits>
#include<iomanip>
#include<math.h>
#include<utility>
long long ans = 0;using namespace std;
int main() {long long n, m;while (cin>>n>>m){ans = (n / 2)*m;cout << ans << endl;}
}

B题 卢卡斯定理

#include <fstream>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <math.h>
#include <bitset>
#include <algorithm>
#include <climits>
#include<iomanip>
#include<math.h>
#include<utility>
typedef long long LL;LL n, m, p=1000000007;LL QM(LL num1, LL num2)
{LL ans = 1;num1 %= p;while (num2){if (num2 & 1){ans = ans * num1 % p;num2--;}num2 >>= 1;num1 = num1 * num1 % p;}return ans;
}LL C(LL n, LL m)
{if (m > n) return 0;LL ans = 1;for (int i = 1; i <= m; i++){LL num1 = (n + i - m) % p;LL num2 = i % p;ans = ans * (num1 * QM(num2, p - 2) % p) % p;}return ans;
}LL Lucas(LL n, LL m)
{if (m == 0) return 1;return C(n % p, m % p) * Lucas(n / p, m / p) % p;
}
LL anss;using namespace std;
int main() {int k,a,x,b,y;while (cin>>k>>a>>x>>b>>y){anss = 0;int tem_k = k;for (int i = 0; i <= x; i++) {tem_k = (k - i*a);if (tem_k<0){break;}int tem_x = i;if (((tem_k%b) == 0)&&((tem_k/b)<=y)) {int tem_y = tem_k / b;if (i == 0) {anss = (anss+ Lucas(y, tem_y)) % p;}else{anss = (anss + Lucas(x, tem_x)*Lucas(y, tem_y)) % p;}}}cout << anss << endl;}
}

C题 贪心

(代码来自另一个大牛)感觉可能是后台数据不严谨,最后卡过去了,因为影响系数还有等级。

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>using namespace std;const int SIZE = 1e5 + 5;struct Base
{int time;int level;
};Base machine[SIZE];
Base task[SIZE];
int record[105];    // 记录每个机器level数bool cmp(const Base &a, const Base &b)
{if (a.time == b.time)return a.level > b.level;elsereturn a.time > b.time;
}int main(int argc, char const *argv[])
{int n, m, ansNum;long long ans;while (~scanf("%d %d", &n, &m)){ans = ansNum = 0;memset(machine, 0, sizeof(machine));memset(task, 0, sizeof(task));memset(record, 0, sizeof(record));for (int i = 0; i < n; ++i){scanf("%d %d", &machine[i].time, &machine[i].level);}for (int i = 0; i < m; ++i){scanf("%d %d", &task[i].time, &task[i].level);}sort(machine, machine + n, cmp);sort(task, task + m, cmp);int j = 0;for (int i = 0; i < m; ++i){while (j < n && task[i].time <= machine[j].time){++record[machine[j].level];++j;}for (int level = task[i].level; level < 101; ++level){if (record[level]){--record[level];++ansNum;ans = ans + task[i].time * 200 + task[i].level * 3;break;}}}printf("%d %lld\n", ansNum, ans);}return 0;
}

腾讯2019实习生笔试(编程题)相关推荐

  1. 网易2019实习生招聘编程题集合

    前言 利用周末时间做了这套网易2019实习生招聘编程题,链接如下: 题目链接 成绩 先来看一下博主的成绩,打了67分,完全做对了4道题,另外的4道题中1道题完成了80%,1道题完成了30%.评价一下就 ...

  2. 网易2019实习生招聘编程题集合 矩形重叠

    网易2019实习生招聘编程题 矩形重叠 题目链接:https://www.nowcoder.com/test/9763997/summary [编程题] 矩形重叠 时间限制:1秒 空间限制:32768 ...

  3. 2012年奇虎360校园招聘实习生笔试编程题

    2012年奇虎360校园招聘实习生笔试编程题 1.  自己实现库函数 int atoi(const char* str);  注意两点:(1). 字符串中,符号位的处理. (2).字符串中,出现非数字 ...

  4. 2018腾讯实习招聘笔试编程题之翻转数列

    题目描述:小Q定义了一种数列称为翻转数列                  给定整数n和m,满足n能被2m整除.对于一串连续递增整数数列1,2,3,4...,每隔m个符号翻转一次,最初符号为'-'   ...

  5. 网易2018实习生笔试编程题

    牛牛的闹钟 时间限制:1秒 空间限制:32768K 牛牛总是睡过头,所以他定了很多闹钟,只有在闹钟响的时候他才会醒过来并且决定起不起床.从他起床算起他需要X分钟到达教室,上课时间为当天的A时B分,请问 ...

  6. 2019美团机器学习/数据挖掘算法实习生笔试 编程题修改矩阵

    主要用于交流思考 1.修改矩阵 时间限制:C/C++语言 1000MS:其他语言 3000MS 内存限制:C/C++语言 65536KB:其他语言 589824KB题目描述: 我们称一个矩阵为黑白矩阵 ...

  7. 网易2019实习生Java编程题

    题1:平面内有n个矩形, 第i个矩形的左下角坐标为(x1[i], y1[i]), 右上角坐标为(x2[i], y2[i]). 如果两个或者多个矩形有公共区域则认为它们是相互重叠的(不考虑边界和角落). ...

  8. 网易2019实习生招聘编程题

    **原题链接:**点这儿 网易的题还是有技术含量的,二分和数学和优美暴力考察得较多,这些东西在工作中确实很重要,都是优化程序的方法. # 第一题:牛牛找工作 ## 题目: > 为了找到自己满意的 ...

  9. 网易2019实习生招聘编程题集合 - 题解

    原题链接:点这儿. 网易的题还是有技术含量的,二分和数学和优美暴力考察得较多,这些东西在工作中确实很重要,都是优化程序的方法. 第一题:牛牛找工作 题目: 为了找到自己满意的工作,牛牛收集了每种工作的 ...

最新文章

  1. 推荐阅读的多核编程技术书籍
  2. 高性能ORM框架XLinq功能详细介绍
  3. 互联网的本质:也论 Web2.0 和 Web1.0
  4. 人工智能助力全国大学生智能车竞赛
  5. solr7.6 安装配置
  6. kotlin 类及其成员的可见性
  7. 《剑指offer》第九题(用两个栈实现队列)
  8. P2168 [NOI2015] 荷马史诗(哈夫曼编码树)
  9. 这个统一了238个机器学习模型R包的参考手册推荐给你
  10. 北航数值分析大作业_北航非全日制研究生学习全纪实(2020.9.27)——一周上课感受...
  11. asp.net 2.0 下的表单验证Cookieless属性
  12. 目标检测(五)--R-CNN
  13. Microsoft SQL Server 2005简体中文开发版下载
  14. 传智播客8月C/C++基础班开班
  15. Clonezilla笔记----安装Clonezilla Live到U盘
  16. web手动进行Form表单提交
  17. 南邮-2043(有才华的罗老师)
  18. SpringBoot如何上传大文件
  19. Linux(CentOS 7)、Windows双系统安装图文教程(超详细)适合初学者
  20. dom4j关于Element和Node的理解

热门文章

  1. Hadoop 的常用组件一览
  2. 【JAVA笔记——道】Hibernate 线程本地化基础篇
  3. 特定时间循环增加一个时间段值
  4. RDL报表制作和发布
  5. php打出等边三角形,CSS 如何进行单一div的正多边形变换
  6. WritableComparable排序的使用案例
  7. 大数据分析平台的发展趋势如何
  8. 数据协作如何解决大数据的大问题
  9. 递推极大似然算法实现
  10. Danfo.js专题 - Danfo.js与Dnotebook简介与入门