QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#789581#9627. 算术GodwangWA 0ms3636kbC++231.9kb2024-11-27 20:58:272024-11-27 20:58:29

Judging History

你现在查看的是最新测评结果

  • [2024-11-27 20:58:29]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3636kb
  • [2024-11-27 20:58:27]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,a,n) for(int i=n;i>=a;i--)
#define endl '\n'
#define ll long long
#define pb push_back

const int N=1e6+10;
const ll mod1=998244353ll;

//////////////////

ll a[100];

/////////////////


/////////////////

void init()
{

}

/////////////////

int main()
{
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  //  freopen("ain.txt","r",stdin);freopen("aout.txt","w",stdout);

    int tt;
    cin>>tt;
    while (tt--)
    {
        priority_queue<ll,vector<ll > ,greater<ll>  > q;
        rep(i,1,9)
        {
            cin>>a[i];
        }

        ll ans=1;

        ll minn=min(a[1],a[2]);
        if(a[1]==a[2]+1)
        {
            minn--;
        }
        a[1]-=minn;
        a[2]-=minn;

        rep(i,1,minn)
        {
            ans*=3ll;
            ans%=mod1;
        }

        
        if(a[1]==1)
        {
            rep(i,2,9)
            {
                if(a[i])
                {
                    a[i]--;

                    ans*=1ll*i+1;
                    ans%=mod1;

                    a[1]=0;
                    break;
                }
            }
        }
        else 
        {
            if(a[1]%3==1)
            {
                a[1]-=4;
                ans*=4ll;
                ans%=mod1;
            }
            else if(a[1]%3==2)
            {
                a[1]-=2;
                ans*=2ll;
                ans%=mod1;
            }
            rep(i,1,a[1]/3)
            {
                ans*=3ll;
                ans%=mod1;
            }


        }

        rep(i,2,9)
        {
            rep(j,1,a[i])
            {
                ans*=1ll*i;
                ans%=mod1; 
            }
        }

        cout<<ans<<endl;
    
    }
    
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3636kb

input:

7
5 3 0 0 0 0 0 0 0
4 1 1 1 0 0 0 0 0
1 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 2
99 88 77 66 55 44 33 22 11
100 90 80 70 60 50 40 30 20

output:

54
108
4
36
324
90553232
143532368

result:

wrong answer 3rd lines differ - expected: '1', found: '4'