/* Dejwo to ziomal ®© */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector <int> vi; typedef pair <int, int> pi; typedef vector<pair<int,int>> vpi; #define pb push_back #define FOR0(n) for(int i = 0; i < n; i++) #define FOR0j(n) for(int j = 0; j < n; j++) #define FOR1(n) for(int i = 1; i <= n; i++) #define FOR1j(n) for(int j = 1; j <= n; j++) #define FOR_REV(n) for(int i = n - 1; i >= 0 ; i--) #define FOR_REVj(n) for(int j = n - 1; j >= 0 ; j--) #define SIZE 200042 #define MAX 1e6 + 42 void solve_brute(int n){ int ans = 0; for( int a = 1; a <= n; a ++){ for( int b = a + a; 2 * b + a < n; b += a){ int c = n - a - b; if( c % b == 0 and c % a == 0) { ans ++; //cout << a << " " << b << " " << c << endl; } } } cout << ans << endl; } void solve (int n){ int ans = 0; vi dividors; for(int i = 1; i * i <= n; i ++) if( n % i == 0) { dividors.pb( i ); if( n / i > i )dividors.pb( n / i); } for( auto a: dividors){ for( int b = a + a; 2 * b + a < n; b += a){ int c = n - a - b; if( c % b == 0 and c % a == 0) { ans ++; //cout << a << " " << b << " " << c << endl; } } } cout << ans << endl; } int main() { ios_base::sync_with_stdio(0); int n; cin >> n; //solve_brute( n ); solve( n ); 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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | /* Dejwo to ziomal ®© */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector <int> vi; typedef pair <int, int> pi; typedef vector<pair<int,int>> vpi; #define pb push_back #define FOR0(n) for(int i = 0; i < n; i++) #define FOR0j(n) for(int j = 0; j < n; j++) #define FOR1(n) for(int i = 1; i <= n; i++) #define FOR1j(n) for(int j = 1; j <= n; j++) #define FOR_REV(n) for(int i = n - 1; i >= 0 ; i--) #define FOR_REVj(n) for(int j = n - 1; j >= 0 ; j--) #define SIZE 200042 #define MAX 1e6 + 42 void solve_brute(int n){ int ans = 0; for( int a = 1; a <= n; a ++){ for( int b = a + a; 2 * b + a < n; b += a){ int c = n - a - b; if( c % b == 0 and c % a == 0) { ans ++; //cout << a << " " << b << " " << c << endl; } } } cout << ans << endl; } void solve (int n){ int ans = 0; vi dividors; for(int i = 1; i * i <= n; i ++) if( n % i == 0) { dividors.pb( i ); if( n / i > i )dividors.pb( n / i); } for( auto a: dividors){ for( int b = a + a; 2 * b + a < n; b += a){ int c = n - a - b; if( c % b == 0 and c % a == 0) { ans ++; //cout << a << " " << b << " " << c << endl; } } } cout << ans << endl; } int main() { ios_base::sync_with_stdio(0); int n; cin >> n; //solve_brute( n ); solve( n ); return 0; } |