PAT甲级 1096 Consecutive Factors
本题坑点就是1不算进入乘积的里面,所以本题的麻烦点就在于1这个东西 ,所以要特判如果同等长度最小起始值为1的话,那么maxlongdu(最大长度)要减去1,本题可以骗分,特判1、2、4、8、14这几个点,算法笔记上抄来的这几个点,本人提交的时候一直卡在测试点4,如果测试点4卡了,我提供一组数据给你们为123 正确输出应该1 3 而不是0 123 1 123 这两个答案,还有一个坑点就是LL这个问题啦,如下附赠本人暴力代码(自己码的代码在一个点卡了很久然后解决AC出来的感觉是真的舒服):
#include <iostream>
#include <cstdio>
#include <map>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long LL;
int isPrime(LL n)
{
if(n<=1) return -1;
LL sqr=(int)sqrt(1.0*n);
for(int i=2;i<=sqr;i++)
{
if(n%i==0) return -