zyx13765814016 @ 2024-10-15 18:23:59
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
if(n==0){
cout<<"0 0 0";
return 0;
}
for(int i=n/7;i>=0;i--){
for(int j=i;j<=n/4;j++){
for(int k=i;k<=n/3;k++){
if(3*k+4*j+7*i==n){
cout<<i<<" "<<j<<" "<<k;
return 0;
}
}
}
}
cout<<-1;
}
by Max_robot @ 2024-10-18 16:45:49
@zyx13765814016
#include<bits/stdc++.h>
using namespace std;
long long n;
int main(){
cin>>n;
if(n==0){
cout<<"0 0 0"<<endl;
return 0;
}
for(int p=n/14;p>=0;p--){
for(int j=p;j<=n/4;j++)
for(int k=p;k<=n/3;k++)
if(p*7+j*4+k*3 == n){
cout<<p<<" "<<j<<" "<<k<<endl;
return 0;
}
}
cout<<-1<<endl;
return 0;
}
求关qwq
by zyx13765814016 @ 2024-10-18 16:53:21
@文锡 欧克克,求回关求加团