会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
π+1
博客园
首页
新随笔
联系
管理
订阅
2019年5月27日
求1+2+3+...+n,要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断语句(A?B:C)。
摘要: public class Solution { public int Sum_Solution(int n) { int sum = n; boolean flag =(n>0) && (sum+=Sum_Solution(n-1))>0; return sum; } }
阅读全文
posted @ 2019-05-27 21:50 紫色的雪
阅读(412)
评论(0)
推荐(0)
公告