QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#766857#9627. 算术rea_lityWA 3ms3600kbC++235.3kb2024-11-20 18:58:492024-11-20 18:58:50

Judging History

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

  • [2024-11-20 18:58:50]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3600kb
  • [2024-11-20 18:58:49]
  • 提交

answer

/*
 * @Author: rea_lity
 * @Date: 2024-11-11 23:50:07
 * @LastEditors: rea_lity
 * @LastEditTime: 2024-11-20 18:57:13
 * @Description: 
 * @FilePath: /test/test.cpp
 */
#include <bits/stdc++.h>
using namespace std;

#define endl "\n"
#define int long long
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f

#define all(x) (x).begin(),(x).end()
#define l first
#define r second

#define MYDEBUG //note: close the debug before submit
#ifdef MYDEBUG
#define Debug(X) cout << #X << ": " << X << ";" << endl
template <typename T>
void debug(vector<T>&nums,int len){
    if(nums.size() + 1 < len)cout << "Overflow: size of anrry is <" << nums.size() << ">,but len is <" << len << ">" << endl;
    else for(int i = 0;i <= len;i++)cout << nums[i] << " \n"[i == len];
}
#else
#define Debug(X) 
template <typename T>
void debug(vector<T>&nums,int& len){}
#endif

const int N = 2e5 + 10;
const int mod = 998244353;

int v[20];

void solve()
{
    for(int i = 1;i <= 9;i++){
        cin >> v[i];
    }
    if(v[2] >= v[1])v[3] += v[1],v[1] = 0;
    else{
        while(v[2] < v[1] - 1){
            if(v[1] < 2)break;
            v[1] -= 2;
            v[2] += 1;
        }
        int mn = min(v[1],v[2]);
        v[1] -= mn,v[2] -= mn;
        v[3] += mn;
    }
    if(v[1]){
        int x = 0;
        for(x = 2;x <= 9;x++)
        {
            if(v[x])break;
        }
        v[x + 1] ++;
        v[x] --;
        v[1] = 0;
    }
    int res = 1;
    for(int i = 10;i >= 2;i--){
        for(int j = 0;j < v[i];j++){
            res = (res * i) % mod;
        }
       //cout << res << endl;
    }
    cout << res << endl;
    for(int i = 1;i <= 10;i++)v[i] = 0;
}

signed main()
{
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int T = 1;
    cin >> T;
    while (T--)solve();
    return 0;
}

/* 
          _____                    _____                    _____                    _____            _____                _____                _____          
         /\    \                  /\    \                  /\    \                  /\    \          /\    \              /\    \              |\    \         
        /::\    \                /::\    \                /::\    \                /::\____\        /::\    \            /::\    \             |:\____\        
       /::::\    \              /::::\    \              /::::\    \              /:::/    /        \:::\    \           \:::\    \            |::|   |        
      /::::::\    \            /::::::\    \            /::::::\    \            /:::/    /          \:::\    \           \:::\    \           |::|   |        
     /:::/\:::\    \          /:::/\:::\    \          /:::/\:::\    \          /:::/    /            \:::\    \           \:::\    \          |::|   |        
    /:::/__\:::\    \        /:::/__\:::\    \        /:::/__\:::\    \        /:::/    /              \:::\    \           \:::\    \         |::|   |        
   /::::\   \:::\    \      /::::\   \:::\    \      /::::\   \:::\    \      /:::/    /               /::::\    \          /::::\    \        |::|   |        
  /::::::\   \:::\    \    /::::::\   \:::\    \    /::::::\   \:::\    \    /:::/    /       ____    /::::::\    \        /::::::\    \       |::|___|______  
 /:::/\:::\   \:::\____\  /:::/\:::\   \:::\    \  /:::/\:::\   \:::\    \  /:::/    /       /\   \  /:::/\:::\    \      /:::/\:::\    \      /::::::::\    \ 
/:::/  \:::\   \:::|    |/:::/__\:::\   \:::\____\/:::/  \:::\   \:::\____\/:::/____/       /::\   \/:::/  \:::\____\    /:::/  \:::\____\    /::::::::::\____\
\::/   |::::\  /:::|____|\:::\   \:::\   \::/    /\::/    \:::\  /:::/    /\:::\    \       \:::\  /:::/    \::/    /   /:::/    \::/    /   /:::/~~~~/~~      
 \/____|:::::\/:::/    /  \:::\   \:::\   \/____/  \/____/ \:::\/:::/    /  \:::\    \       \:::\/:::/    / \/____/   /:::/    / \/____/   /:::/    /         
       |:::::::::/    /    \:::\   \:::\    \               \::::::/    /    \:::\    \       \::::::/    /           /:::/    /           /:::/    /          
       |::|\::::/    /      \:::\   \:::\____\               \::::/    /      \:::\    \       \::::/____/           /:::/    /           /:::/    /           
       |::| \::/____/        \:::\   \::/    /               /:::/    /        \:::\    \       \:::\    \           \::/    /            \::/    /            
       |::|  ~|               \:::\   \/____/               /:::/    /          \:::\    \       \:::\    \           \/____/              \/____/             
       |::|   |                \:::\    \                  /:::/    /            \:::\    \       \:::\    \                                                   
       \::|   |                 \:::\____\                /:::/    /              \:::\____\       \:::\____\                                                  
        \:|   |                  \::/    /                \::/    /                \::/    /        \::/    /                                                  
         \|___|                   \/____/                  \/____/                  \/____/          \/____/                                                   
                                                                                                                  
 */

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3592kb

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
1
10
90
90553232
143532368

result:

ok 7 lines

Test #2:

score: -100
Wrong Answer
time: 3ms
memory: 3600kb

input:

1000
22 80 50 23 35 71 81 70 96
40 33 36 2 51 52 96 5 32
56 35 85 13 58 80 26 14 31
60 21 8 19 79 5 94 44 33
85 55 10 59 76 98 28 22 69
14 72 40 14 100 68 5 18 69
95 42 51 0 32 97 37 34 85
54 33 18 40 34 10 72 72 68
81 47 80 23 23 68 40 3 71
58 7 36 79 89 83 5 68 16
30 3 82 79 35 28 30 55 88
17 86 2...

output:

971495748
321820208
765709043
819408880
639261805
380788374
7172464
780360907
240853384
151457742
298466126
759900810
124742738
751026627
493291429
416032026
409158325
951979430
825701006
422909906
440485591
163247072
78098984
421935223
308024444
168349368
423889166
405465710
827159852
914298923
465...

result:

wrong answer 1st lines differ - expected: '376701872', found: '971495748'