Add FZOI Codes

This commit is contained in:
2024-06-26 22:14:00 +08:00
parent 8f564ca60e
commit b80791cfad
49 changed files with 1653 additions and 0 deletions

View File

@ -0,0 +1,20 @@
#include <bits/stdc++.h>
#define int long long
using namespace std;
int m;
int f(int a, int b)
{
if(b == 0) return 1 % m;
else if(b % 2 == 1) return (f(a, (b - 1)) * a) % m;
return (f(a, b / 2) * f(a, b / 2)) % m;
}
signed main()
{
int a, b;
cin >> a >> b >> m ;
cout << a << "^" << b << " mod " << m << "=" << f(a, b) ;
return 0;
}