Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
71129 sh25_wangtaojie 幂的末尾 C++ 通过 0 MS 248 KB 487 2025-10-24 15:04:11

Tests(1/1):


#include <iostream> #include <iomanip> using namespace std; int main() { int a, b; cin >> a >> b; if (b == 0) { cout << "001" << endl; return 0; } int result = 1; int base = a % 1000; while (b > 0) { if (b % 2 == 1) { result = (result * base) % 1000; } base = (base * base) % 1000; b /= 2; } cout << setw(3) << setfill('0') << result << endl; return 0; }


测评信息: