bird_秒切橙题 @ 2020-05-24 11:37:59
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
if(n==0)
{
cout<<"0 0 0";
}
if(n<=2||n==5)
{
cout<<-1;
return 0;
}
int a=n/14;
n%=14;
int b=a,c=a;
if(n%3==1){
b++;
c+=n/3-1;
}
else if(n%3==2){
b+=2;
c+=n/3-2;
}
else
c+=n/3;
cout<<a<<" "<<b<<" "<<c;
return 0;
}
by donghanwen1225 @ 2020-05-24 11:54:29
主要就是开三重循环,第一重枚举套数,第二重枚举a,第三重枚举b
by bird_秒切橙题 @ 2020-05-24 11:54:36
我 问 你 们 哪 里 错 了 怎 么 这 么 多 乱 七 八 糟 的
by bird_秒切橙题 @ 2020-05-24 11:55:26
@donghanwen1225 10^5三重肯定会超啊!
by _tommysun_ @ 2020-05-24 11:55:55
@small_bird 是您自己说可以秒切橙题的,另外题解摆在那是干啥的?玩的?
by bird_秒切橙题 @ 2020-05-24 11:56:36
@tommysun 题解是啥
by critnos @ 2020-05-24 11:56:41
@small_bird 您不是秒切橙题吗
by bird_秒切橙题 @ 2020-05-24 11:56:48
@tommysun 百度吗
by k3v1n070828 @ 2020-05-24 11:57:34
@tommysun 题解是啥
IEE
by donghanwen1225 @ 2020-05-24 11:58:12
for(int i=n/14;i>=0;i--) { int now=n-i*14; if(now==0) { print(i,0,0,0); return 0; }
if(now==1||now==2||now==5) continue;
for(int j=now/3;j>=0;j--)
{
int no=now-j*3;
if(no==1||no==2||no==5) continue;
if(no==0)
{
print(i,j,0,0);
retrun 0;
}
for(int k=no/4;k>=1;k--)
{
int w=no-k*4;
if(w==1||w==2||w==5) continue;
if(w==0)
{
print(i,j,k,0);
retrun 0;
}
}
}
}
if(!pd) cout<<-1;
void prnit(int ts,int c,int b,int a)
{
cout<<ts<<" "<<b+ts<<" "<<c+ts;
pd=1;
retrun;
}```
by donghanwen1225 @ 2020-05-24 11:58:30
你照着改一改吧