lalalala


私信TA

用户名:zhangshuo

访问量:151558

签 名:

像狗一样的学习,像绅士一样地玩耍。

等  级
排  名 5
经  验 30087
参赛次数 10
文章发表 201
年  龄 12
在职情况 学生
学  校 芜湖市第十一中学
专  业

  自我简介:

今日懒惰流下的口水,将会成为明日里伤心的泪水。

1317 摆地摊


 时间限制: 1 s

 空间限制: 128000 KB

 题目等级 : 大师 Master

题解

题目描述 Description

    由于经济紧张,可怜的Antinomyra只好在传说中的YL区商业文明街上摆起了地摊卖作业-------本。Antinomyra为了赚更多的钱,于是了解了在这条街上各个位置每个时段摆摊的期望收入,然后期待不断地更换摆摊位置来使得自己的收入最多。

    假设该条街的长度为N,那么,Antinomyra把该条街道划分成N个长度为1的区间,Antinomyra可以在其中的任意一个区间摆摊。对于每一个区间,其摆摊的收益是随时间周期性变化的,比如3天为周期,第1天在该处摆摊能赚100元,第2天在该处摆摊能赚200元,第3天在该处摆摊要亏50元(可能碰上CG队),那么第4、7、10…天同第一天,第5、8、11….天同第二天,第6,9,12…天同第3天。且对于每一个区间,周期数可以不相同。

    而由于移动摊位很麻烦,所以Antinomyra最多一天移动一次,即在某一天摆摊结束之后移动到另一个摊位,且由于Antinomyra懒,所以每次最多移动一个位置,即每次只能移到该天摊位旁边的两个位置中的一个,当然,也可以不移动。而摆摊的第一天可以选择任何一个位置。

    现在Antinomyra想知道的是,他摆摊最多t天后,最多能赚多少钱。请额外注意,Antinomyra可以在任意时刻收摊回家,并且再也不来,但是至少摆摊一天。

输入描述 Input Description

共N+1行。第一行输入两个数N(N10),T(T1016),表示街长度为N,Antinomyra准备摆摊T天。接下来N行,第i+1行输入格式为,先输入一个数M(M10),表示区间i的收入周期长度,该行接下来的M个数表示周期中的每一天在该位置摆摊能收入多少。

输出描述 Output Description

输出Antinomyra最多能赚多少钱。

样例输入 Sample Input

2 3

1 3

2 2 4

样例输出 Sample Output

10

数据范围及提示 Data Size & Hint

该数据街道长度为2,在第1个位置每天都能赚3块钱,而第2个位置奇数天能赚2块钱,偶数天能赚4块钱,故Antinomyra第1天在1号位摆摊,第二天移到2号位,第三天又移回1号位置摆摊。

面对这道骚气的题目,某某选择了这个:

#include <iostream>
#include <cstdio>
using namespace std;
long long n,t,m,i,j,ans;
int main()
  {
  cin>>n>>t;
  for(i=1;i<=n;i++)
   {
     cin>>m;
for(j=1;j<=m;j++)cin>>ans;
 }
if(n==2 && t==18468)
 {
   cout<<"49351"<<endl;
   return 0;
      }
    if(n==7 && t==31330)
      {
      cout<<"1665103"<<endl;
      return 0;
 }
if(n==1 && t==221472164162665)
 {
 	cout<<"1860366178966452"<<endl;
 	return 0;
 }
if(n==6 && t==301481373960711)
 {
 	cout<<"11738631909930540"<<endl;
 	return 0;
 }
if(n==8 && t==154297192532641)
 {
 	cout<<"13732450135405046"<<endl;
 	return 0;
 }
if(n==6 && t==465245111751865)
 {
 	cout<<"28690115224698288"<<endl;
 	return 0;
 }
if(n==3 && t==128222430474570)
 {
 	cout<<"7472518309323608"<<endl;
 	return 0;
 }
if(n==1 && t==443768125923255)
 {
 	cout<<"-53"<<endl;
 	return 0;
 }
if(n==3 && t==355175408192259)
 {
 	cout<<"22498388912267436"<<endl;
 	return 0;
 }
if(n==3 && t==416161550817043)
 {
 	cout<<"19559592888401017"<<endl;
 	return 0;
 }
if(n==1 && t==288834771622602)
 {
 	cout<<"-1"<<endl;
 	return 0;
 }
if(n==2 && t==16828)
 {
 	cout<<"588980"<<endl;
 	return 0;
 }
if(n==7 && t==230150689797813)
 {
 	cout<<"11474655819919602"<<endl;
 	return 0;
 }
if(n==5 && t==3903)
 {
 	cout<<"227828"<<endl;
 	return 0;
 }
if(n==2 && t==27530)
 {
 	cout<<"700442"<<endl;
 	return 0;
 }
if(n==9 && t==19630)
 {
 	cout<<"786596"<<endl;
 	return 0;
 }
if(n==4 && t==10384)
 {
 	cout<<"356320"<<endl;
 	return 0;
 }
if(n==1 && t==4597)
 {
 	cout<<"-88"<<endl;
 	return 0;
 }
if(n==9 && t==24485)
 {
 	cout<<"1491699"<<endl;
 	return 0;
 }
if(n==7 && t==11512)
 {
 	cout<<"721367"<<endl;
 	return 0;
 }
return 0;
  }
令人震撼,不可思议!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


 

0.0分

0 人评分

  评论区