Codeforces Round #552 (Div. 3)
作者:互联网
暴力求解
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<iostream>
#include<cstring>
#include<set>
#include<vector>
#include<string>
using namespace std;
typedef long long ll;
const int N=1e6+10;
const int INF=1000000007;
const double eps=0.0000001;
int a[N];
int b[14]={0,1,2,0,2,1,0,0,1,2,0,2,1,0};
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int x,y,z,day=0,sum=0;
cin>>x>>y>>z;
int ans=min(x/3,min(y/2,z/2));
x-=ans*3;
y-=ans*2;
z-=ans*2;
for(int i=0;i<7;i++)
{
a[0]=x,a[1]=y,a[2]=z;
day=0;
for(int j=i;j<i+7;j++)
{
if(a[b[j]])
{
a[b[j]]--;
day++;
}
else
break;
}
sum=max(sum,day);
}
cout<<ans*7+sum<<endl;
}
标签:const,cin,int,Codeforces,long,552,ans,Div,include 来源: https://blog.csdn.net/weixin_43870114/article/details/89362050