1 条题解

  • 1
    @ 2024-3-6 18:46:46
    #include <iostream>
    #include <string>
    using namespace std;
    
    int main() {
        int a, b;
        cin >> a >> b;
    
        long long result = 1;
        for (int i = 0; i < b; i++) 
        {
            result *= a;
            result %= 1000; 
        }
    
        string strResult = to_string(result);
        if (strResult.length() < 3) 
        {
            for (int i = 0; i < 3 - strResult.length(); i++) 
            {
                cout << "0";
            }
        }
        cout << result << endl;
    
        return 0;
    }
    
    
    • 1

    信息

    ID
    125
    时间
    1000ms
    内存
    128MiB
    难度
    10
    标签
    (无)
    递交数
    4
    已通过
    2
    上传者