Language: C++
#include <iostream>
using namespace std;
long long int Mod(long long int a, long long int b, long long int c) {
if(b == 0) return 1;
if(b % 2 == 1) return a * Mod(a*a % c, b/2, c) % c;
else return Mod(a*a % c, b/2, c) % c;
}
int main(int argc, char *argv[]) {
long long int k, N, m;
cout<< "k: " ;
cin >> k ;
cout<< "N: ";
cin>> N ;
cout<< "m: ";
cin>> m ;
cout << k << "^" << N << " mod " << m << "=" << Mod(k, N, m) << endl;
return 0;
}
想问说怎么用argc argv在规定的command format上跑?
这里的command format是 /a.out k N m
爬了一些文,但还是看不懂该如何处理
所以想请问各位该如何解决?
谢谢