1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
void fpR(unsigned int s, unsigned int pe, int_v& p){
std::string b;
while (pe > 0){
b = std::to_string(s*s);
b.erase( std::remove_if( b.begin(), b.end(), [](char c){return c == '0';} ), b.end() );
if (b.size() == 8){
b.erase(0, 2);
b.erase(b.begin()+4, b.end());
p.push_back(std::stoi(b, nullptr, 10));
}
else if (b.size() == 7){
b.erase(0, 2);
b.erase(b.begin()+4, b.end());
p.push_back(std::stoi(b, nullptr, 10));
}
else if (b.size() == 6){
b.erase(0, 2);
p.push_back(std::stoi(b, nullptr, 10));
}
else if (b.size() == 5){
b.erase(0, 1);
p.push_back(std::stoi(b, nullptr, 10));
}
else if (b.size() == 4){
p.push_back(std::stoi(b, nullptr, 10));
}
else {
s+=101;
continue;
}
s = std::stoi(b, nullptr, 10);
pe--;
}
}
|