8
8
2015
1

机房の日常(真•NOIP模拟赛) T1

为什么又是T1呢。。因为弱弱的窝只A掉了T1。。。。
T2被自己坑了一下。。

lyd的旅行(trip.*)(内存限制:512MB  时间限制:1s  代码长度限制:50KB)

【题目描述】
众所周知,lyd是一个人赢。他有很多很多的妹子
某天,他带着他的众多妹子进行了一次旅(dou)行(feng),由于lyd的车上妹子太多超重了,所以车速每秒最多只能改变d个单位,lyd在出发和回家前都看了速度表,记下了出发的初速度v1和回家的末速度v2,以及行驶时间t,但是由于中途lyd和妹子了,所以他并不知道中途行驶了多长路程。

现在lyd想知道他最多行驶了多长路程。

【输入数据】
第一行两个整数v1,v2
第二行两个整数t和d
意义如题所示

【输出数据】
一行一个整数表示答案

【样例输入1】
5 6
4 2

【样例输出1】
26

【样例输入2】
10 10
10 0

【样例输出2】
100


【样例解释】

样例1:每个单位的时间分别是5,7,8,6,答案=5+7+8+6=26
样例2:反正速度不能变,就一直开下去好了

【数据规模与约定】
对于100%的数据
1<=v1,v2<=100
2<=t<=100
0<=d<=10

【提醒】

谁告诉你单位时间和单位速度可以分割了!

【后记】

 

Lyd大爷使用了lydtree回到了过去重新进行了一次旅行,于是他就不需要泥了~

int efl(int x,int y)
{
	if(x+3>=y)
	{
		for(int i=x;i<=y;++i)
			if(P[now].w-P[i].w<=len && P[now].w-P[i-1].w>len)
				return i;
	}
	int m=(x+y)>>1;
	if(P[now].w-P[m].w>len)return efr(m+1,y);
	return efr(x,m);//<-------------↑---就是他们
}

然后t1就是正着跑一趟,倒着跑一趟。每次算出可以取出的最大值。。然后就好了。

#include <string>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cstring>
#include <ctime>
#include <cmath>
#include <algorithm>
#include <queue>
#include <set>
#include <map>

using namespace std;

#define gch getchar
#define mp make_pair

char C_get;
void read(int &x)
{
	for(x=0,C_get=gch();(C_get<'0'||C_get>'9')&&C_get!='-'&&C_get!='+';C_get=gch());
	if(C_get=='-')
	{
		for(C_get=gch();C_get>='0'&&C_get<='9';C_get=gch())x=x*10-C_get+'0';
	}
	else
	{
		if(C_get=='+')C_get=gch();
		for(;C_get>='0'&&C_get<='9';C_get=gch())x=x*10+C_get-'0';
	}
}

void read(long long &x)
{
	for(x=0,C_get=gch();(C_get<'0'||C_get>'9')&&C_get!='-'&&C_get!='+';C_get=gch());
	if(C_get=='-')
	{
		for(C_get=gch();C_get>='0'&&C_get<='9';C_get=gch())x=x*10-C_get+'0';
	}
	else
	{
		if(C_get=='+')C_get=gch();
		for(;C_get>='0'&&C_get<='9';C_get=gch())x=x*10+C_get-'0';
	}
}

void read(double &x)
{
	for(x=0,C_get=gch();(C_get<'0'||C_get>'9')&&C_get!='-'&&C_get!='+';C_get=gch());
	if(C_get=='-')
	{
		for(C_get=gch();C_get>='0'&&C_get<='9';C_get=gch())x=x*10-C_get+'0';
		if(C_get=='.')
		{
			double n=1;
			for(C_get=gch();C_get>='0'&&C_get<='9';C_get=gch())n/=10,x=x-(C_get+'0')*n;
		}
	}
	else
	{
		if(C_get=='+')C_get=gch();
		for(;C_get>='0'&&C_get<='9';C_get=gch())x=x*10+C_get-'0';
		if(C_get=='.')
		{
			double n=1;
			for(C_get=gch();C_get>='0'&&C_get<='9';C_get=gch())n/=10,x=x+(C_get-'0')*n;
		}
	}
}

void read(char &x)
{
	x=gch();
	while(x=='\n'||x==' '||x=='\r')x=gch();
}

void read(char x[]){gets(x);}

int v1,v2,t,d;
long long va[200],vb[200];
long long ans=0; 

int main()
{		
	read(v1); read(v2);
	read(t); read(d);
	va[1]=v1; vb[t]=v2;
	for(int i=2;i<=t;++i)
	{
		va[i]=va[i-1]+d;
	}
	for(int i=t-1;i>=1;--i)
	{
		vb[i]=vb[i+1]+d;
	}
	for(int i=1;i<=t;++i)ans+=min(va[i],vb[i]);
	printf("%lld\n",ans);
	return 0;
}
Category: 比赛 | Tags: | Read Count: 605
Avatar_small
Flandre Scarlet 说:
2015年8月10日 12:57

一个读入优化就AK人生还有希望哒?
连毛萌力都艹不过搞什么OI!


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter

Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com