次方求模

2019-04-13 21:50发布

次方求模 #include int main() {          int n=2,p=10000;          int result = 1;           while (p > 0)           {                     if (p % 2 == 1)                     {                              result = (result*n) % 3;                     }                     p /= 2;                     n = (n*n) % 3;      }          printf("%d ",result);          return 0; }