Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 1.cpp : Defines the entry point for the console application.
- //
- #include <map>
- #include <iostream>
- #include <fstream>
- #include <iomanip>
- #include <algorithm>
- #include <cmath>
- #include <set>
- #include <cstdlib>
- #include <cstdio>
- #include <stack>
- #include <string>
- #include <cctype>
- typedef long long ll;
- typedef long double ld;
- using namespace std;
- int main()
- {
- ifstream fin("sqr-equations.in");
- ofstream fout("sqr-equations.out");
- fin.sync_with_stdio(false);
- fout.sync_with_stdio(false);
- ll A;
- fin >> A;
- A += 1;
- set<pair<ll, ll>> sett;
- if (A == 0){
- fout << "infinity";
- fin.close();
- fout.close();
- return 0;
- }
- if (A > 0){
- for (ll i = 1; i <= (ll)sqrt(abs(A)); i++){
- if (A%i == 0){
- sett.insert({ i + 1, A / i + 1 });
- sett.insert({ -A / i + 1, -i + 1 });
- }
- }
- fout << sett.size();
- }
- else{
- for (ll i = -1; i >= (ll)-sqrt(abs(A)); i--){
- if (A%i == 0){
- sett.insert({ i + 1, A / i + 1 });
- sett.insert({ -A/i + 1, -i + 1 });
- //cout << i << ' ' << A / i << endl;
- }
- }
- fout << sett.size();
- }
- fin.close();
- fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement