博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
codewars-014: k-Primes
阅读量:6950 次
发布时间:2019-06-27

本文共 584 字,大约阅读时间需要 1 分钟。

hot3.png

// https://www.codewars.com/kata/k-primes/train/javapackage codewars;class PrimeConsec{  public static int primeDecomp(long n){    int i=2;    int count=0;    while(n >= i){      if(n % i == 0){        n = n / i;        count++;      }else{        i++;      }    }    return count;  }  public static int consecKprimes(int k, long[] arr){    int[] factor = new int[arr.length];    int count = 0;    for(int i=0; i < arr.length; i++){      if(factor[i] == k && factor[i] == factor[i + 1]){        count++;      }    }    return count;  }}

 

转载于:https://my.oschina.net/u/553266/blog/804604

你可能感兴趣的文章
不仅仅是Google,您必须知道的全球十大地图API
查看>>
php排序
查看>>
JSP与Servlet之间传值
查看>>
JavaScript&jQuery.动态删除元素
查看>>
pickle和json模块
查看>>
Python基本语法_输入/输出语句详解
查看>>
用 Flask 来写个轻博客 (4) — (M)VC_创建数据模型和表
查看>>
快速入门分布式消息队列之 RabbitMQ(2)
查看>>
IIS安装与部署,站点的部署与配置
查看>>
Google两步验证的工作原理
查看>>
es6 babel编译
查看>>
过滤器(转载)
查看>>
PLSQL基本操作
查看>>
persisted? vs new_record?
查看>>
Linux下禁止ping最简单的方法
查看>>
一个用户下表、批量授予权限给另一个用户
查看>>
Hibernate 关联映射
查看>>
mybatis spring maven
查看>>
Introduction of Open CASCADE Foundation Classes
查看>>
C#程序之二 -- 数独小游戏(1. UI设计)
查看>>