摘要: 已知一球从高空落下时,每次落地后反弹至原高度的四分之一再落下。编写一程序,从键盘输入整数n和m,求该球从n米的高空落下后,第m次落地时共经过的路程以及第m次落地后反弹的高度,并输出结果。 my code: #include <stdio.h>int main(){ int n,m,i; scanf( 阅读全文
posted @ 2023-10-25 18:24 2B青年~ 阅读(114) 评论(0) 推荐(0)
摘要: my code : double myPow(double x, int n){ if (0 == x || 1 == x){ return 1; } while(n){ x *= myPow(x); --n; }return x; } 我自己也不知道这一坨是什么 correct code : do 阅读全文
posted @ 2023-10-25 13:22 2B青年~ 阅读(11) 评论(0) 推荐(0)
摘要: 调用函数的代码: bool isSameAfterReversals(int num){ int newans = 0,newans2 = 0,i = num; if(i < 10){ return true; } while(i > 0){ newans = newans * 10 + i % 1 阅读全文
posted @ 2023-10-25 09:33 2B青年~ 阅读(20) 评论(0) 推荐(0)
摘要: 给定两个整数,求出他们的最大公约数。 my code: #include <stdio.h> int main(){ int a,b,t,x,target; int max(int a,int b){ int c; c = (a > b ? a : b); return c; } int min ( 阅读全文
posted @ 2023-10-24 08:06 2B青年~ 阅读(36) 评论(0) 推荐(0)