Luban @ 2020-03-08 08:52:46
#include<bits/stdc++.h>
using namespace std;
int bb[]={0,0,0,0,1,0,0,1,2,0,1,2,0,1};
int cc[]={0,0,0,1,0,0,2,1,0,3,2,1,4,3};
int main()
{
int n,a,b,c;
cin>>n;
if (n<3||n==5)
{
cout<<-1<<endl;
return 0;
}
a=n/14;
b=n/14;
c=n/14;
n%=14;
if (!n)
{
cout<<a<<" "<<b<<" "<<c<<endl;
return 0;
}
if (n<3||n==5)
{
n+=14;
a--;
b--;
c--;
if (n==15)
{
cout<<a<<" "<<b<<" "<<c+5<<endl;
}
if (n==16)
{
cout<<a<<" "<<b+1<<" "<<c+4<<endl;
}
if (n==19)
{
cout<<a<<" "<<b+1<<" "<<c+5<<endl;
}
return 0;
}
cout<<a<<" "<<b+bb[n]<<" "<<c+cc[n]<<endl;
return 0;
}
Test1错了,其他AC
据检测为n=0时这玩意会直接输出-1,死定了
by az111522240 @ 2020-03-08 08:54:05
我没加inline和register 75分,加了90分
我死了QAQ
by lndjy @ 2020-03-08 08:55:16
暴力其实可以和打表一样快的,详情看我题解
by Aw顿顿 @ 2020-03-08 08:56:54
我暴力75分挂机ing
by Luban @ 2020-03-08 08:58:16
@Aw顿顿 为我祈福把,不要有0这种毒瘤数据把
by Sya_Resory @ 2020-03-08 08:59:07
窝暴力20pts抱灵ing
by az111522240 @ 2020-03-08 09:01:43
@水题淹死的鱼 大佬大佬!
by Infinity_ @ 2020-03-08 09:01:48
直接在n/14-100 ~ n/14+100之间枚举前2个数实测可以......(估计+10,-10也行)这就是O(1)了?
by 芷陌陌吖 @ 2020-03-08 09:03:23
我才20分啊
by fresh_boy @ 2020-03-08 09:05:02
@Aw顿顿 诶我也75,主要是n≤14的时候,题意搞错了
by FCB_Yiyang2006✈ @ 2020-03-08 09:12:36
@唱歌的向日葵 +1