哪里错了这道题问了一个多月了还是八十分。。。

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

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 k3v1n070828 @ 2020-05-24 19:31:01

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,ans=0;
    cin>>n;
    if(n==0)
    {
        cout<<0<<" "<<0<<" "<<0;
        return 0;
    }
    if(n<6 && n!=4 && n!=3)
    {
        printf("-1");
        return 0;
    }
    ans=n/14;
    n%=14;
    if(n<6&&n!=4&&n!=3&&n!=0)
    ans--,n+=14;
    if(n==0)
    {
        cout<<ans<<" "<<ans<<" "<<ans<<endl;
        return 0;
    }                                       
    if(n==3)
    {
      cout<<ans<<" "<<ans<<" "<<ans+1<<endl;
      return 0;
    }
    if(n==4)
    {
        cout<<ans<<" "<<ans+1<<" "<<ans<<endl;
        return 0;
    }
    if(n==6)
    {
        cout<<ans<<" "<<ans<<" "<<ans+2<<endl;
        return 0;
    }
    if(n==7)
    {
        cout<<ans<<" "<<ans+1<<" "<<ans+1<<endl;
        return 0;
    }
    if(n==8)
    {
        cout<<ans<<" "<<ans+2<<" "<<ans<<endl;
        return 0;
    }
    if(n==9)
    {
        cout<<ans<<" "<<ans<<" "<<ans+3<<endl;
        return 0;
    }
    if(n==10)
    {
        cout<<ans<<" "<<ans+1<<" "<<ans+2<<endl;
        return 0;
    }
    if(n==11)
    {
        cout<<ans<<" "<<ans+2<<" "<<ans+1<<endl;
        return 0;
    }
    if(n==12)
    {
        cout<<ans<<" "<<ans<<" "<<ans+4<<endl;
        return 0;
    }
    if(n==13)
    {
        cout<<ans<<" "<<ans+1<<" "<<ans+3<<endl;
        return 0;
    }
    if(n==15)
    {
    cout<<ans<<" "<<ans<<" "<<ans+5<<endl;
    return 0;
    }
    if(n==16)
    {
        cout<<ans<<" "<<ans+1<<" "<<ans+4<<endl;
        return 0;
    }
    if(n==19)
    {
      cout<<ans<<" "<<ans+1<<" "<<ans+5<<endl;
        return 0;
    }
    return 0;
}

代码搬运工


by k3v1n070828 @ 2020-05-24 21:12:20

@small_bird 出来解释一下为什么恁跟某位神犇的AC代码相同?


by k3v1n070828 @ 2020-05-24 22:29:08

@small_bird 请回答


by k3v1n070828 @ 2020-05-26 13:33:48

新闻出锅快两天了,还有人没看吗?

又要更新啦


by bird_秒切橙题 @ 2020-05-26 20:02:58

@M652 解释一下!


by wangyilin @ 2020-05-27 20:00:02

@M652 订阅


by k3v1n070828 @ 2020-05-27 20:01:48

@wangyilin 诶?还有5天断更,而且就是当一个琐事数据库吧,不想跟文文竞争


by wangyilin @ 2020-05-27 20:03:01

@M652 好,但还是要持续关注


by wangyilin @ 2020-05-27 20:03:14

@M652 资瓷小M新闻


by Aw顿顿 @ 2020-05-30 11:04:24

@M652 文文已经咕了(


上一页 | 下一页