乘方计算(邪修解法) 解题思路:其实不必在意这个题目的归类,数学一类的好多算法可以调数学库解决,里面已经有打包好的函数可以用了注意事项:参考代码:inta,n;scanf("%d%d",&a,&n);inty=pow(a,n);printf("%d",y); 题解列表 2026年09月01日 0 点赞 0 评论 124 浏览 评分:0.0
循环+累乘解乘方an 解题思路:注意事项:参考代码:#includeintmain(){inta=0,n=0;scanf("%d%d",&a,&n);longlongresult=1;//累乘初始值设为1(乘法单位元)if(n==0){result=1;//"任何除0以外的数的0次方都是1"}else{f 题解列表 2025年12月24日 0 点赞 0 评论 281 浏览 评分:0.0
新手乘方计算 摘要:# 这里使用的是for循环int main(){ int a = 0;int n = 0; scanf("%d %d", &a, &n); //判断n是否等于0 …… 题解列表 2025年06月16日 0 点赞 0 评论 424 浏览 评分:10.0
新手 乘方计算 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int a,b,c; scanf("%d%d",&a,&b); c=pow(a,b); …… 题解列表 2024年12月07日 0 点赞 0 评论 505 浏览 评分:0.0
超简单新手题解 摘要:解题思路:pow函数注意事项:参考代码:#i#include <stdio.h>int main() { int a,b,j; scanf("%d %d",&a,&b); j=pow(a,b); pr…… 题解列表 2024年11月07日 0 点赞 0 评论 451 浏览 评分:2.0
2805: 乘方计算 摘要:解题思路:注意事项:因为是乘,所以“sum=1”,不是“sum=0”参考代码:#include <bits/stdc++.h>using namespace std;int main(){ in…… 题解列表 2024年06月30日 1 点赞 0 评论 464 浏览 评分:0.0
乘方计算C解 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int m,a,n; scanf("%d %d",&a,&n); m=pow(a,n); …… 题解列表 2024年02月17日 0 点赞 0 评论 496 浏览 评分:0.0
for循环c语言版 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int a,n; int ax=1; scanf("%d %d",&a,&n); if(…… 题解列表 2023年11月04日 0 点赞 0 评论 694 浏览 评分:9.9
2805: 乘方计算(C语言之奇奇怪怪解法) #include//power函数使用递归方式计算乘方。如果指数n为0,返回1。如果指数n为偶数,递归计算a^(n/2)并返回结果的平方。如果指数n为奇数,递归计算a^((n-1)/2),将结果与a相乘,然后再乘以结果的平方。longlongintpower(inta, 题解列表 2023年07月07日 0 点赞 1 评论 716 浏览 评分:9.9
使用库函数math 摘要:解题思路:注意事项:pow函数只能支持float和double型参考代码:#include<stdio.h>#include<math.h>int main(){ int a,b; int…… 题解列表 2023年04月17日 0 点赞 0 评论 750 浏览 评分:9.9