QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#468531#5. 在线 O(1) 逆元yzc358230151Compile Error//C++14294b2024-07-08 21:23:352024-11-05 22:00:06

Judging History

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

  • [2024-11-05 22:00:06]
  • 管理员手动重测本题所有提交记录
  • [2024-07-08 21:23:35]
  • 评测
  • [2024-07-08 21:23:35]
  • 提交

answer

#include"inv.h"
#include<unordered_map>
using std::unordered_map;
typedef long long ll;
#define MOD 998244353;
int inv[MOD];
void init(int p){
	Inv[1]=1;
}
int inv(int x){
	if(!x)
		return 0;
	else if(Inv[x])
		return Inv[x];
	else
		return (ll)(MOD-MOD/x)%MOD*inv(MOD%x)%MOD;
}

详细

implementer.cpp: In function ‘int main()’:
implementer.cpp:22:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   22 |         scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~
answer.code:5:22: error: expected ‘]’ before ‘;’ token
    5 | #define MOD 998244353;
      |                      ^
answer.code:6:9: note: in expansion of macro ‘MOD’
    6 | int inv[MOD];
      |         ^~~
answer.code:6:12: error: expected unqualified-id before ‘]’ token
    6 | int inv[MOD];
      |            ^
answer.code: In function ‘void init(int)’:
answer.code:8:9: error: ‘Inv’ was not declared in this scope; did you mean ‘inv’?
    8 |         Inv[1]=1;
      |         ^~~
      |         inv
answer.code: In function ‘int inv(int)’:
answer.code:13:17: error: ‘Inv’ was not declared in this scope; did you mean ‘inv’?
   13 |         else if(Inv[x])
      |                 ^~~
      |                 inv
answer.code:5:22: error: expected ‘)’ before ‘;’ token
    5 | #define MOD 998244353;
      |                      ^
answer.code:16:29: note: in expansion of macro ‘MOD’
   16 |                 return (ll)(MOD-MOD/x)%MOD*inv(MOD%x)%MOD;
      |                             ^~~
answer.code:16:28: note: to match this ‘(’
   16 |                 return (ll)(MOD-MOD/x)%MOD*inv(MOD%x)%MOD;
      |                            ^
answer.code:16:36: error: expected primary-expression before ‘/’ token
   16 |                 return (ll)(MOD-MOD/x)%MOD*inv(MOD%x)%MOD;
      |                                    ^
answer.code:5:22: error: expected ‘)’ before ‘;’ token
    5 | #define MOD 998244353;
      |                      ^
answer.code:16:48: note: in expansion of macro ‘MOD’
   16 |                 return (ll)(MOD-MOD/x)%MOD*inv(MOD%x)%MOD;
      |                                                ^~~
answer.code:16:47: note: to match this ‘(’
   16 |                 return (ll)(MOD-MOD/x)%MOD*inv(MOD%x)%MOD;
      |                                               ^
answer.code:16:51: error: expected primary-expression before ‘%’ token
   16 |                 return (ll)(MOD-MOD/x)%MOD*inv(MOD%x)%MOD;
      |                                                   ^