Suuon_Kanderu @ 2020-03-08 08:52:17
#include<iostream>
#include<cmath>
#include<cstdio>
#include<cstring>
using namespace std;
const int N = 0x7fffffff;
int minn(int a,int b,int c) {
int t = N;
if(a < t)t = a;
if(b < t)t = b;
if(c < t)t = c;
}
signed main()
{
// freopen("order.in","r",stdin);
// freopen("order.out","w",stdout);
long long n,a,b,c,ma = 0,mb = 0,mc = 0;
cin >> n;
if(n%14 == 0){
cout << n/14 << " " << n/14 << " " << n/14 << endl;
return 0;
}
for( a = 0; a <= n/7; a++){
for(int b = 0; b <= (n-a)/4; b++){
c = (-7*a-4*b+n)/3;
if(c < 0)continue;
if(7*a+4*b+3*c == n){
if(minn(a,b,c) > minn(ma,mb,mc)){
ma = a; mb = b; mc = c;
continue;
}
else if(minn(a,b,c) == minn(ma,mb,mc) && a + b + c > ma + mb +mc){
ma = a; mb = b; mc = c;
}
}
}
}
if(ma == 0 && mb == 0 && mc == 0)cout << -1 << endl;
else cout << ma << " " << mb << " " << mc << endl;
// fclose(stdin);
// fclose(stdout);
return 0;
}
by 江户川·萝卜 @ 2020-03-08 08:53:07
我了个娘欸,打个表不好么
by 江户川·萝卜 @ 2020-03-08 08:56:41
呵呵你只拿了【n是14的倍数】和【无解】的分
by 江户川·萝卜 @ 2020-03-08 08:56:55
minn函数没返回值啊
by fresh_boy @ 2020-03-08 09:00:08
@可爱小鲁班 您不用炫您的95分了
by Suuon_Kanderu @ 2020-03-08 09:02:27
@huyanfeng2007 我¥%……&*
by Suuon_Kanderu @ 2020-03-08 09:02:43
改了以后AC
by 江户川·萝卜 @ 2020-03-08 09:24:30
@唱歌的向日葵 蛤?我也是95hhh