国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

1096. Consecutive Factors (20)

2019-11-11 01:49:54
字體:
來源:轉載
供稿:網友

Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factored as 3*5*6*7, where 5, 6, and 7 are the three consecutive numbers. Now given any positive N, you are supposed to find the maximum number of consecutive factors, and list the smallest sequence of the consecutive factors.

Input Specification:

Each input file contains one test case, which gives the integer N (1

#include<cstdio>#include<cmath>typedef long long ll;int main(){ ll n; scanf("%lld",&n); ll a=(ll)sqrt(n); int ansI=0,ansLen=0; for(int i=2;i<=a;i++){ int j=i; ll temp=1; while(1){ temp*=j; if(n%temp!=0) break; if(ansLen<j-i+1){ ansI=i; ansLen=j-i+1; } j++; } } if(ansLen==0){
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 革吉县| 东港市| 肥东县| 雅安市| 庄河市| 彭阳县| 弋阳县| 崇仁县| 汉沽区| 洛川县| 明水县| 社旗县| 乐清市| 广宗县| 万山特区| 高雄县| 凤山市| 翁牛特旗| 隆德县| 兴化市| 永仁县| 开江县| 云霄县| 留坝县| 同江市| 那坡县| 华宁县| 兴义市| 灵璧县| 郸城县| 玛沁县| 竹山县| 团风县| 栖霞市| 行唐县| 绵阳市| 彝良县| 砚山县| 章丘市| 峨山| 东莞市|