QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#738328#5. 在线 O(1) 逆元dqw60 5600ms3912kbC++23687b2024-11-12 18:42:192024-11-12 18:42:23

Judging History

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

  • [2024-11-12 18:42:23]
  • 评测
  • 测评结果:60
  • 用时:5600ms
  • 内存:3912kb
  • [2024-11-12 18:42:19]
  • 提交

answer

//  __  __   _  _____ _   _   _____   ______          __
//  \ \/ /  / \|_   _| | | | |  __ \ / __ \ \   /\   / /
//   \  /  / _ \ | | | | | | | |  | | |  | \ \ /  \ / /
//   /  \ / ___ \| | | |_| | | |__| | |__| |\ V /\ V /
//  /_/\_/_/   \_\_|  \___/  |_____/ \___\_\ \_/  \_/ (TM)

#include <bits/stdc++.h>
#include "inv.h"
using namespace std;
#define ll long long
int inv(int x)
{
	ll int a=x;
	ll int m = 998244353;
    ll int u = 0, v = 1;
    while (a != 0)
    {
        ll int t = m / a;
        m -= t * a;
        swap(a, m);
        u -= t * v;
        swap(u, v);
    }
    return (1ll * u + 998244353) % 998244353;
}
void init(int p){
	return;
}

詳細信息


Pretests


Final Tests

Test #1:

score: 10
Accepted
time: 12ms
memory: 3912kb

Test #2:

score: 20
Accepted
time: 1121ms
memory: 3704kb

Test #3:

score: 30
Accepted
time: 5600ms
memory: 3828kb

Test #4:

score: 0
Time Limit Exceeded

Test #5:

score: 0
Time Limit Exceeded