本快读快写仅适用整数输入输出
本快读快写仅适用整数输入输出
本快读快写仅适用整数输入输出
64位整数乘法
#include <bits/stdc++.h>
using namespace std;
struct read
{
static const int M = 1 << 23;
char buf[M], *S = buf, *P = buf, c, l;
inline char gc() { return (S == P && (P = (S = buf) + fread(buf, 1, M, stdin), S == P) ? EOF : *S++); }
template<typename T> read &operator>>(T &x)
{
for (c = 0;!isdigit(c);c = gc()) l = c;
for (x = 0;isdigit(c);c = gc()) x = (x << 1) + (x << 3) + (c ^ 48);
return x = (l ^ 45) ? x : -x, *this;
}
}in;
#define cin in
struct write
{
static const int M = 1 << 23;
char buf[M], *O = buf, s[50], len;
inline void out(char x) { (O - buf < M) ? (*O++ = x) : (fwrite(buf, O - buf, 1, stdout), O = buf, *O++ = x); }
inline void put() { fwrite(buf, O - buf, 1, stdout); } // 主函数结束行加上 return cout.put(), 0;
write &operator<<(char x) { out(x); return *this; }
template<typename T> write &operator<<(T x) { if (x < 0) out('-'), x = -x; if (!x) out('0'); for (len = 0;x;x /= 10) s[++len] = x % 10 + '0'; while (len--) out(s[len + 1]); return *this; }
}out;
#define cout out
signed main()
{
__int128 a, b, p; cin >> a >> b >> p;
cout << a * b % p << '\n';
return cout.put(), 0;
}
%%%