90pts求助

P6188 [NOI Online #1 入门组] 文具订购

Tangent233 @ 2020-03-09 10:46:34

#include<bits/stdc++.h>
using namespace std;
int biao[3][14]={{0},{0,0,0,0,1,0,0,1,2,0,1,2,0,1},{0,0,0,1,0,0,2,1,0,3,2,1,4,3}};
int main()
{
//  freopen("order.in","r",stdin);
//  freopen("order.out","w",stdout);
    int n;
    int a,b,c;
    cin>>n;
    if(n==0) cout<<"0 0 0";
    else if(n<3||n==5) cout<<"-1";
    else if(n<14)
    {
        cout<<biao[0][n]<<' '<<biao[1][n]<<' '<<biao[2][n];
    }
    else if(n%14==0)
    {
        int k=n/14;
        cout<<k<<' '<<k<<' '<<k;
    }
    else
    {
        int k=n/14;
        n%=14;
        if(n==5)
        {
            a=k-1+0;
            b=k-1+1;
            c=k-1+5;
        }
        else 
        {
            a=biao[0][n]+k;
            b=biao[1][n]+k;
            c=biao[2][n]+k;
        }
        cout<<a<<' '<<b<<' '<<c;
    }
    return 0;
}

错了#13 和 #14


by Tangent233 @ 2020-03-09 10:52:24

@Hilarious_Reality 没看懂,还是想要代码啊(

题解没看懂


by memsetst @ 2020-03-09 10:53:21

@TangentBS 如果取模后n<3你会怎么办呢?


by memsetst @ 2020-03-09 10:53:29

自然就错了


by memsetst @ 2020-03-09 10:53:49

你连15都过不了吧


by Tangent233 @ 2020-03-09 10:56:25

@memsetst 我明白了


by Tangent233 @ 2020-03-09 10:57:12

@memsetst 无解吗


by memsetst @ 2020-03-09 10:57:38

@TangentBS 当然不是啊


by memsetst @ 2020-03-09 10:58:05

你需要把n变成n+14后求解


by Tangent233 @ 2020-03-09 10:59:08

@memsetst 哦

还好我的表是到19的


by Tangent233 @ 2020-03-09 11:06:20

@memsetst AC了

谢谢!


|