#include <iostream>
#include <vector>
using namespace std;
vector<int> zdzielnikuj (int n, int pocz, int tresh){
vector<int> dzielniki;
for(int i = pocz; i*i<=n; i++){
if(n%i==0){
if(i!=n/i&&n/i<=n/tresh){
dzielniki.push_back(n/i);
}
if(i<=n/tresh){
dzielniki.push_back(i);
}
}
}
return dzielniki;
}
int main()
{
int n;
cin>>n;
vector<int> dzielniki = zdzielnikuj(n, 1, 7);
int solutions = 0;
for(int d:dzielniki){
int m = (n-d)/d;
solutions += zdzielnikuj(m, 2, 3).size();
// for(int b: zdzielnikuj(m, 2, 3)){
// cout<<"a b c: "<<d<<" "<<b*d<<" "<<n-d-b*d<<" "<<endl;
// }
}
cout<<solutions;
return 0;
}
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 36 37 38 | #include <iostream> #include <vector> using namespace std; vector<int> zdzielnikuj (int n, int pocz, int tresh){ vector<int> dzielniki; for(int i = pocz; i*i<=n; i++){ if(n%i==0){ if(i!=n/i&&n/i<=n/tresh){ dzielniki.push_back(n/i); } if(i<=n/tresh){ dzielniki.push_back(i); } } } return dzielniki; } int main() { int n; cin>>n; vector<int> dzielniki = zdzielnikuj(n, 1, 7); int solutions = 0; for(int d:dzielniki){ int m = (n-d)/d; solutions += zdzielnikuj(m, 2, 3).size(); // for(int b: zdzielnikuj(m, 2, 3)){ // cout<<"a b c: "<<d<<" "<<b*d<<" "<<n-d-b*d<<" "<<endl; // } } cout<<solutions; return 0; } |
English