#include<iostream> using namespace std; #include<string> #include<cmath> int main() { int n; while (cin >> n) { string str = to_string((int)pow(n, n)); //pow返回的是double类型 cout << str[str.size() - 1] << endl; } } |
Double click to view unformatted code.