Cripple_Abyss @ 2020-04-24 14:43:21
#include<iostream>
#include<cstdio>
using namespace std;
int n,s1=-1,s2=-1,t1,t2,ans1,ans2,ans3;
int main() {
cin>>n;
if (n%14==0) {
cout<<n/(7+4+3)<<' '<<n/(7+4+3)<<' '<<n/(7+4+3);
return 0;
}
for (int k=0; k<=7146; k++)
for (int j=0; j<=7146; j++) {
int i=n-k*7-j*4;
i/=3;
if (k*7+j*4+i*3==n&&i>=0)
t1=min(i,min(j,k)),t2=k+j+i;
if (t1>s1) {
s2=t2,ans1=k,ans2=j,ans3=i;
s1=t1;
} else if (t1==s1) {
if (t2>s2)
s2=t2,ans1=k,ans2=j,ans3=i;
s1=t1;
}
}
if (s2==-1||s2==0)
cout<<"−1";
else
cout<<ans1<<' '<<ans2<<' '<<ans3;
return 0;
}
by liqingyang @ 2020-04-24 14:46:00
@KyireIvring 卡下常数?
by tangrunxi @ 2020-04-24 14:56:16
@KyireIvring
cout<<-1;
之后要return 0;
by tangrunxi @ 2020-04-24 15:00:05
@KyireIvring 我谔谔,你cout<<"-1"
负号是俄文的
by tangrunxi @ 2020-04-24 15:00:21
还好我查出来了
by lndjy @ 2020-04-24 15:06:34
俄文珂海星
by Ryo_Yamada @ 2020-04-24 15:52:17
谔谔谔谔谔谔