Waley's blog

By Waley, history, 5 years ago, In Russian

include

include

define ull unsigned long long

define ll long long

using namespace std;

int main() { ll a, b, m; cin >> a >> b >> m; ll q = (long double)a * b / m; ll res = a * b — q * m; while(res < 0) { res += m; } while(res >= m) { res -= m; } cout << res; }

  • Vote: I like it
  • -37
  • Vote: I do not like it