zbw666 @ 2020-03-10 16:31:48
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
int n;
int main(){
cin>>n;
if(n==0){
cout<<"0 0 0"<<endl;
return 0;
}
if(n<14){
if(n<=2 || n==5){
cout<<-1;
return 0;
}
if(n%3==0){
cout<<0<<" "<<0<<" "<<n/3;
}
else if(n%3==1){
cout<<0<<" "<<1<<" "<<n/3-1;
}
else{
cout<<0<<" "<<2<<" "<<n/3-2;
}
return 0;
}
if(n%14==0){
cout<<n/14<<" "<<n/14<<" "<<n/14;
return 0;
}
else{
int a=n/3,b=0,c=0;
if(n%3==1)
a--,b++;
else if(n%3==2)
a-=2,b+=2;
for(;;){
if(a>b){
a-=4;
b+=3;
}
else{
a+=4;
b-=3;
break;
}
}
for(;;){
if(c>b){
c--,b++,a++;
break;
}
c++,b--,a--;
}
cout<<c<<" "<<b<<" "<<a;
return 0;
}
cout<<"-1"<<endl;
return 0;
}
by TheAutumnGlory @ 2020-03-10 16:32:29
不会,告辞
by zbw666 @ 2020-03-10 16:32:58
....
by zzx0826 @ 2020-03-10 16:35:13
第一眼以为是
by mulberror @ 2020-03-10 16:35:17
枚举最小值,分类讨论,然后解一下二元方程就好了。
by zzx0826 @ 2020-03-10 16:36:30
您为什么要特判呢?
特判很容易挂的
by zbw666 @ 2020-03-10 16:36:32
这。。
by zbw666 @ 2020-03-10 16:36:54
我错的是第17个点
by zbw666 @ 2020-03-10 16:37:13
不是特判的错
by zbw666 @ 2020-03-10 16:38:45
@Chhokmah,读不懂
by impuk @ 2020-03-10 16:40:53
反正我是直接打表然后AC。