题解 2805: 乘方计算

来看看其他人写的题解吧!要先自己动手做才会有提高哦! 
返回题目 | 我来写题解

筛选

2805: 乘方计算(C语言之奇奇怪怪解法)

#include//power函数使用递归方式计算乘方。如果指数n为0,返回1。如果指数n为偶数,递归计算a^(n/2)并返回结果的平方。如果指数n为奇数,递归计算a^((n-1)/2),将结果与a相乘,然后再乘以结果的平方。longlongintpower(inta,

使用库函数math

摘要:解题思路:注意事项:pow函数只能支持float和double型参考代码:#include<stdio.h>#include<math.h>int main(){    int a,b;    int……

给用Java的开一下荒土

摘要:解题思路:注意事项:参考代码:import java.util.Scanner; public class Main { public static void main(String[] a……

2805: 乘方计算 快速幂方法

摘要:解题思路: 快速幂注意事项:参考代码:#include <iostream> // #include <sstream> #include <cstdio> // #include <algor……

有错误请指出

摘要:解题思路:注意事项:参考代码:#include <stdio.h>int main(){   int a,n;   scanf("%d %d",&a,&n);   int i=0,cheng=1;  ……