vmware以及schlumberger题解
先是vmare的:具体的题目我就不描述了。
1. 贪吃的小明。直接数个数,统计个数,就可以完成。使用map,应该输入implement这一类,我认为很简单,但是我只过了33%。
/*
ID: y1197771
PROG: test
LANG: C++
*/
#include<bits/stdc++.h>
#define pb push_back
#define FOR(i, n) for (int i = 0; i < (int)n; ++i)
#define dbg(x) cout << #x << " at line " << __LINE__ << " is: " << x << endl
typedef long long ll;
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1e3 + ;
string s[] = {"ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX" };
void solve() {
int n, a, b, c;
string s1, s2;
a = b = c = ;
map<string, int> m;
cin >> n;
for (int i = ; i < ; i++) m[s[i] ] = i;
for (int i = ; i < n; i++) {
cin >> s1 >> s2;
if(m[s1] > m[s2]) a++;
else if(m[s1] < m[s2]) b++;
else c++;
}
cout << a << " " << b << " " << c << endl;
if(b < a) {
cout << "MingMing Win" << endl;
} else {
cout << "LiangLiang Win" << endl;
} }
int main() {
//freopen("test.in", "r", stdin);
//freopen("test.out", "w", stdout);
solve();
return ;
}
2. 贾昆的谍报计划,可以从任意点开始,最长下降路径,更leetcode https://leetcode.com/problems/longest-increasing-path-in-a-matrix/这道题一致吧, 我认为是一样,因为上升和下降是完全一致的。这题我也没100%ac,但是我写的在leetcode可以ac啊,我不知道什么情况。我好想知道怎么回事了,set判重导致的错误,换priority_queue就可以。
/*
ID: y1197771
PROG: test
LANG: C++
*/
#include<bits/stdc++.h>
#define pb push_back
#define FOR(i, n) for (int i = 0; i < (int)n; ++i)
#define dbg(x) cout << #x << " at line " << __LINE__ << " is: " << x << endl
typedef long long ll;
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1e3 + ;
int a[][];
int cnt[][];
struct node {
int v, x, y;
bool operator<(const node & t) const {
return v < t.v;
}
};
int dx[] = {, , , -};
int dy[] = {, , -, };
void solve() {
set<node> se;
int n, m, x, y; cin >> n >> m;
for (int i = ; i < n; i++) {
for (int j = ; j < m; j++) {
cin >> x; a[i][j] = x;
se.insert({x, i, j});
cnt[i][j] = ;
}
}
int res = ;
while(!se.empty()) {
int p = se.begin()->v;
x = se.begin()->x; y = se.begin()->y;
//cout << p << " " << x << " " << y << " " << res << endl;
res = max(res, cnt[x][y]);
se.erase(se.begin());
for (int i = ; i < ; i++) {
int cx = x + dx[i], cy = y + dy[i];
if(cx < || cx >= n || cy < || cy >= m) continue;
if(a[cx][cy] <= p) continue;
cnt[cx][cy] = max(cnt[x][y] + , cnt[cx][cy]);
}
}
cout << res << endl;
}
int main() {
freopen("test.in", "r", stdin);
//freopen("test.out", "w", stdout);
solve();
return ;
}
3.旗帜计数,这道题比较变态,很难,后来查了一下,是cf原题,转移方程+快速幂,转移方程不好搞,链接在这里http://codeforces.com/problemset/problem/93/D注意,这题是div1的第4道题,当时ac的不到100人左右。
schlimberger
1. mumuchacha的珍珠手链,求固定窗口内最大值,直接滑动窗口O(1)的转移,很简单,或者是前缀和,代码难度比较低。直接过。
/*
ID: y1197771
PROG: test
LANG: C++
*/
#include<bits/stdc++.h>
#define pb push_back
#define FOR(i, n) for (int i = 0; i < (int)n; ++i)
#define dbg(x) cout << #x << " at line " << __LINE__ << " is: " << x << endl
typedef long long ll;
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1e5 + ;
int n, m;
int a[maxn * ];
void solve() {
int cur = ;
cin >> n >> m;
for (int i = ; i <= n; i++) {
cin >> a[i];
a[i + n] = a[i];
if(i < m) cur += a[i];
}
int res = a[];
for (int i = m; i <= n + m; i++) {
cur += a[i];
if(i - m > ) cur -= a[i - m];
res = max(res, cur);
}
cout << res << endl; }
int main() {
//freopen("test.in", "r", stdin);
//freopen("test.out", "w", stdout);
int i; cin >> i;
while(i--)
solve();
return ;
}
2. 量子通讯工程,看完题目,就是写一个kruskal或者prim来求mst。 好久没写,发现都不会写了,刚好对dsu比较熟,就写了prim。
/*
ID: y1197771
PROG: test
LANG: C++
*/
#include<bits/stdc++.h>
#define pb push_back
#define FOR(i, n) for (int i = 0; i < (int)n; ++i)
#define dbg(x) cout << #x << " at line " << __LINE__ << " is: " << x << endl
typedef long long ll;
using namespace std;
typedef pair<double, double> pii;
const int maxn = 1e3 + ;
double d[][];
int n;
vector<pair<double, double>> a;
double work(pii x, pii y) {
return sqrt((x.first - y.first) * (x.first - y.first) + (x.second - y.second) * ((x.second - y.second)) );
}
bool vis[];
int f[maxn];
int fd(int x) {
if(x == f[x]) return f[x];
return f[x] = fd(f[x]);
}
struct node {
double d;
int x, y;
bool operator <(const node & t) const {
return d < t.d;
}
} e[];
void solve() {
cin >> n;
double x, y;
for (int i = ; i < n; i++) {
cin >> x >> y;
a.pb({x, y});
f[i] = i;
}
int num = ;
for (int i = ; i < n; i++) {
for (int j = i + ; j < n; j++) {
double t = work(a[i], a[j]);
e[num].d = t; e[num].x = i, e[num].y = j;
num++;
}
}
sort(e, e + num);
double res = ;
for (int i = ; i < num; i++) {
int a1 = e[i].x, a2 = e[i].y;
x = e[i].d;
a1 = fd(a1); a2 = fd(a2);
if(a1 != a2) {
//cout << e[i].x << " " << e[i].y << " " << x << endl;
f[a1] = a2;
res += x;
}
}
printf("%.2f\n", res); }
int main() {
//freopen("test.in", "r", stdin);
//freopen("test.out", "w", stdout);
solve();
return ;
}
也是直接过。
3. 下载管理软件,读题,主要是:任何下载的时候带宽都是满的,但是并行度个数有限制,然后我就想:直接模拟吧,按结束时间加入set进行模型,调了一个小时才过了33%。后来听师兄讲解,就是所有的任务加起来除以总带宽,那个并行度属于干扰项,我很惊讶,原来还可以这样!
写出来的有效代码不到5行,而我字节写的模拟,洋洋洒洒快到100行了。衰!
/*
ID: y1197771
PROG: test
LANG: C++
*/
#include<bits/stdc++.h>
#define pb push_back
#define FOR(i, n) for (int i = 0; i < (int)n; ++i)
#define dbg(x) cout << #x << " at line " << __LINE__ << " is: " << x << endl
typedef long long ll;
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1e3 + ;
void solve() {
int t, n, w;
double s = ;
cin >> t >> n >> w;
double task; int p;
for (int i = ; i < t; i++) {
cin >> task >> p;
s += task * ( - p) / ;
}
printf("%.2f\n", s / w);
}
int main() {
freopen("test.in", "r", stdin);
//freopen("test.out", "w", stdout);
solve();
return ;
}
vmware以及schlumberger题解的更多相关文章
- Vulnhub靶场题解
Vulnhub简介 Vulnhub是一个提供各种漏洞环境的靶场平台,供安全爱好者学习渗透使用,大部分环境是做好的虚拟机镜像文件,镜像预先设计了多种漏洞,需要使用VMware或者VirtualBox运行 ...
- vmware里面的名词 vSphere、vCenter Server、ESXI、vSphere Client
vmware里面的名词 vSphere.vCenter Server.ESXI.vSphere Client vSphere.vCenter Server.ESXI.vSphere Client VS ...
- vmware上网的方式
vmware上网设置 vmware虚拟机上网设置 我的一些心得,如下: 如何使vmware虚拟机中的操作系统能够上网? 第一种情况: 主机使用PPPOE拨号上网 方法一:NAT方式 1.先关闭虚拟机中 ...
- 如何安全的将VMware vCenter Server使用的SQL Server Express数据库平滑升级到完整版
背景: 由于建设初期使用的vSphere vCenter for Windows版,其中安装自动化过程中会使用SQL Server Express的免费版数据库进行基础环境构建.而此时随着业务量的增加 ...
- 在开启DRS的集群中修复VMware虚拟主机启动问题
通过iSCSI方式连接到ESXi主机上的外挂存储意外失联了一段时间,导致部分虚拟主机在集群中呈现出孤立的状态,单独登陆到每台ESXi上可以看到这些虚拟主机都变成了unknow状态.因为有过上一次(VM ...
- 通过VMware的PowerCLI配置集群内指定主机的vMotion功能
PowerCLI是VMware开发的基于微软(MSFT)的PowerShell的命令行管理vSphere的实现,因此在批量化操作方面CLI会减轻很多GUI环境下的繁琐重复劳作. 现有场景中有大量的物理 ...
- 设置Hyper-V和VMware多个服务之间共存
这个方法是解决多个服务之间不能共存,下面相当于是以Hyper-V和VMware做例子,其他的也适用. 今天准备安装VMware Workstation 10,然后玩玩MAC OS. 没想到,淡定的我双 ...
- 在VMware上安装CentOS -7
1.下载好VMware 2.准备好CentOS的镜像文件 3.打开VMware创建新的虚拟机 选择自定义高级后按下一步 继续下一步 选择稍后安装操作系统 客户机操作系统选择Linux,版本选择Cent ...
- VMware下对虚拟机Ubuntu14系统所在分区sda1进行磁盘扩容
VMware下对虚拟机Ubuntu14系统所在分区sda1进行磁盘扩容 一般来说,在对虚拟机里的Ubuntu下的磁盘进行扩容时,都是添加新的分区,而并不是对其系统所在分区进行扩容,如在此链接中http ...
随机推荐
- 1.(1)编写一个接口ShapePara,要求: 接口中的方法: double getArea():获得图形的面积。double getCircumference():获得图形的周长 (2)编写一个圆类Circle,要求:圆类Circle实现接口ShapePara。 该类包含有成员变量: radius:public 修饰的double类型radius,表示圆的半径。 x:private修饰的dou
package jiekou1; public interface ShapePara { //定义常量PI final double PI=3.14; //定义抽象方法 //获得图形面积 doubl ...
- spring jdbcTemplate源码剖析
本文浅析 spring jdbcTemplate 源码,主要是学习其设计精髓.模板模式.巧妙的回调 一.jdbcTemplate 类结构 ①.JdbcOperations : 接口定义了方法,如 &l ...
- 【WPF】 打开本地的文件或者文件夹
问题描述: 我做的程序中需要添加帮助文档,我将文档生成了CHM格式,在用户点击帮助按钮时候 弹出帮助文档. 实现方法: System.Diagnostics.Process.Start(AppDoma ...
- android开发学习:打电话和发短信
1.新建一个android项目 File--New--Other--android application project 填写application name(就是应用的名字.比方:天天酷跑) 填写 ...
- 文件I/O(不带缓冲)之read函数
调用read函数从打开文件中读数据. #include <unistd.h> ssize_t read( int filedes, void *buf, size_t nbytest ); ...
- error “base class has incomplete type”
error "base class has incomplete type" 如果base.h是你的基类,那么在子类derive中,写成如下形式: class base; clas ...
- keyStore vs trustStore--转载
原文:http://lukejin.iteye.com/blog/605634 今天有同事向我问起这两个概念,所以我就记录下.首先我们得澄清一些概念.一个web应用如果需要提供以https的方式访问的 ...
- Android(java)学习笔记86:案例短信发送器
1.一般我们第一步都是先创建这个main.xml布局文件,这是良好的习惯: <?xml version="1.0" encoding="utf-8"?&g ...
- Hibernate - list()和iterate()的区别
list()和iterate()都可以用来获得Query取得的HQL结果list()使用的是即时加载.查询时会之前去数据库查询HQL并将所有结果存在缓存中.iterate()使用的是延时加载.查询时只 ...
- android 按两次返回键退出应用
private long mExitTime; @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCod ...