QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#567277#5. 在线 O(1) 逆元hlyCompile Error//C++14313b2024-09-16 10:45:002024-11-05 22:03:54

Judging History

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

  • [2024-11-05 22:03:54]
  • 管理员手动重测本题所有提交记录
  • [2024-09-16 10:45:01]
  • 评测
  • [2024-09-16 10:45:00]
  • 提交

answer

#include <inv.h>

int prime; 
void init(int p)
{
	prime=p;
}

int inv(int x)
{
	int s1=1,s2=0;
	int t1=0,t2=1;
	int a=x,b=prime;
	int q;
	while(b!=0)
	{
		q=a/b;
		int c=a;
		a=b;
		b=c-a*q;
		int s3=s2;
		s2=-1*q*s3+s1;
		s1=s3;
		int t3=t2;
		t2=-1*q*t3+t1;
		t1=t3;
	}
	return s2;
}

Details

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:1:10: fatal error: inv.h: No such file or directory
    1 | #include <inv.h>
      |          ^~~~~~~
compilation terminated.