wwhOvO @ 2020-03-11 21:50:06
感觉有用的优化都用上了啊QAQ还是只有90分。。。
请问哪里还要优化啊QAQ
#include <iostream>
#include <stdio.h>
#include <math.h>
#define DEBUG printf("aa/7=%d bb/4=%d cc/3=%d\n",aa/7,bb/4,cc/3)
#define DEBUG2 printf("a=%d b=%d c=%d\n\n",a,b,c)
#define DEBUG3 printf("aa=%d bb=%d cc=%d\n",aa,bb,cc)
using namespace std;
int n,a,b,c;
int main()
{
//freopen("order.in","r",stdin);
//freopen("order.out","w",stdout);
scanf("%d",&n);
if(n==3) {printf("0 0 1\n");return 0;}
if(n==4) {printf("0 1 0\n");return 0;}
if(n==7) {printf("0 1 1\n");return 0;}
if(n%14==0)
{
a=b=c=(n/14);
printf("%d %d %d\n",a,b,c);
return 0;
}
for(int i=1;i<=n/3;i++)
{
int aa,bb,cc=i*3;
int can=n-cc;
for(int j=1;j<=can/4;j++)
{
int nans=a+b+c;
int minn=min(min(a,b),c);
//cout<<minn<<endl;
bb=j*4;
aa=n-(bb+cc);
//DEBUG3;
if((aa+bb+cc==n)&&(aa%7==0)&&(aa>=0))
{
int now=min(min(aa/7,bb/4),cc/3);
//DEBUG;
//if(a==0&&b==0&&c==0) {a=aa/7,b=bb/4,c=cc/3;continue;}
if(now>=minn)
{
//DEBUG;
//cout<<"now="<<now<<endl;
//cout<<minn<<endl;
int ans=(aa/7)+(bb/4)+(cc/3);
//cout<<"ans="<<ans<<" "<<"nans="<<nans<<endl;
//cout<<"a="<<a<<" "<<"b="<<b<<" "<<"c="<<c<<endl;
if(ans>=nans) {a=aa/7,b=bb/4,c=cc/3;continue;}
//cout<<"Get a answer:"<<"a="<<a<<" "<<"b="<<b<<" "<<"c="<<c<<endl;
//<<"-------------------\n";
if(now!=minn) a=aa/7,b=bb/4,c=cc/3;
}
}
}
}
if(a==0&&b==0&&c==0) printf("-1\n");
else printf("%d %d %d\n",a,b,c);
return 0;
}
by wwhOvO @ 2020-03-11 22:03:42
@liqingyang 蟹蟹qwq
by liqingyang @ 2020-03-11 22:04:27
@BinaryTree 把那些注释删了试试
by wwhOvO @ 2020-03-11 22:05:50
@liqingyang ......这和注释没什么关系罢
by liqingyang @ 2020-03-11 22:06:26
@BinaryTree 可以看看我的提交记录
by liqingyang @ 2020-03-11 22:06:47
@BinaryTree 注释好像也会变慢。。。
by impuk @ 2020-03-11 22:14:52
@liqingyang 注释会变慢??
这又是哪个邪教徒在到处传播的东西
注释对程序没有影响的好吧。
by liqingyang @ 2020-03-11 22:15:42
@一只爬行者 会变慢一点点嘛,例如0.001ms
by do_while_false @ 2020-03-11 22:16:05
@liqingyang 什么鬼,编译的时候就没了好吧???
by liqingyang @ 2020-03-11 22:16:16
@一只爬行者 刚学OI,或许是我想多了
by impuk @ 2020-03-11 22:18:20
@liqingyang 编译器会把注释吧唧吧唧吃掉。
放到程序里就根本看不出来了。
不排除极个把奇葩编译器