fork download
  1. /*----<Bồ tác phù hộ code không bị bug>--------
  2.   _oo0oo_
  3.   o8888888o
  4.   88" . "88
  5.   (| -_- |)
  6.   0\ = /0
  7.   ___/`---'\___
  8.   .' \| |// '.
  9.   / \||| : |||// \
  10.   / _||||| -:- |||||- \
  11.   | | \ - /// | |
  12.   | \_| ''\---/'' |_/ |
  13.   \ .-\__ '-' ___/-. /
  14.   ___'. .' /--.--\ `. .'___
  15.   ."" '< `.___\_<|>_/___.' >' "".
  16.  | | : `- \`.;`\ _ /`;.`/ - ` : | |
  17.  \ \ `_. \_ __\ /__ _/ .-` / /
  18. =====`-.____`.___ \_____/___.-`___.-'=====
  19.   `=---='
  20. ------------------<>-------------------------*/
  21.  
  22. #include <bits/stdc++.h>
  23.  
  24. #define __Nakano signed
  25. #define Miku__ main()
  26. #define int long long
  27. #define fi first
  28. #define se second
  29. #define all(x) x.begin(), x.end()
  30. #define rall(x) x.rbegin(), x.rend()
  31. #define fr(x, l, r) for (int x = l; x < r; x++)
  32. #define frr(x, l, r) for (int x = l; x <= r; x++)
  33. #define fd(x, l, r) for (int x = l; x >= r; x--)
  34. #define cs const
  35. #define TIME (1.0*clock() / CLOCKS_PER_SEC)
  36. #define RUNTIME cerr << "\n" << "Runtime: " << TIME << "s\n";
  37. #define Fastio ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  38. #define Nakanomiku ios_base::sync_with_stdio(0);
  39. #define TiemNetBaTuyen cin.tie(0);
  40. #define THCSPHAMHUYTHONG cout.tie(0);
  41.  
  42. typedef double db;
  43. typedef std::string str;
  44. typedef std::vector<int> vi;
  45. typedef std::greater<int> gi;
  46. typedef std::map<int, int> mii;
  47. typedef std::pair<int, int> ii;
  48.  
  49. inline int gcd(int a,int b){int s;while(b){s=a%b;a=b;b=s;}return a;}
  50. inline int lcm(int a, int b){return a/gcd(a,b)*b;}
  51.  
  52. cs int N = 1e6 + 5;
  53. cs int oo = 1e18;
  54.  
  55. using namespace std;
  56. int power(int a,int b,int c){
  57. a %= c;
  58. int res = 0;
  59. while (b){
  60. if (b & 1) res = (res + a) % c;
  61. a = (a * 2) % c;
  62. b >>= 1;
  63. }
  64. return res;
  65. }
  66. __Nakano Miku__ {
  67. Nakanomiku TiemNetBaTuyen THCSPHAMHUYTHONG
  68. int a,b,c; cin >> a >> b >> c;
  69. cout << power(a,b,c);
  70. RUNTIME;
  71. return 0;
  72. }
  73.  
Success #stdin #stdout #stderr 0s 5276KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Runtime: 0.004281s