Go to diff to previous submission
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define DEBUG(x) cerr << ">> " << #x << ": " << x << endl; #define REP(i,a) for (int i =0; i < (a);++i) #define FOR(i,a,b) for (int i = (a); i <= (b); ++i) int n; char c,c2; int main() { while (cin >> c >> c2 >> n) { /* for (int n = 1; n < 100; n++) { cout << "n is " << n << ": "; */int count = 0; for (int x = n+1; x <= 2*n;x++) { if ((n * x) % (x-n) == 0) { count++; //cout << "(" << ((n * x) / (x-n)) << "," << x << ") "; } } printf("%d\n", count); } return 0; }
--- c5.s667.cteam014.fl.cpp.0.two2.cpp +++ c5.s1012.cteam014.fl.cpp.0.all.cpp @@ -20,47 +20,27 @@ #define FOR(i,a,b) for (int i = (a); i <= (b); ++i) -char pom; int n; -unsigned long long x,y; -unsigned long long lft, rght; -int counter = 0; -bool once = false; +char c,c2; + int main() { - // while (scanf("%d%d",) != EOF) - while ( cin >> pom >> pom >> n ){ - int x = n + 1; - y = x; - counter = 0; - lft= n * ( x + y ); - rght = x * y; - while ( true ){ - if ( lft == rght ){ - once = false; - //cout << "reseni " << x << " " << y; - x = x + 1; - y = x; - lft= n * ( x + y ); - rght = x * y; - counter++; - } else if ( lft < rght ){ - if ( !once ){ - //moc velka x a y - break; - } - x++; - y = x; - lft= n * ( x + y ); - rght = x * y; - once = false; - } else { - once=true; - y++; - lft = lft + n; - rght = rght + x; - } + while (cin >> c >> c2 >> n) + { + /* + for (int n = 1; n < 100; n++) + { + cout << "n is " << n << ": "; + */int count = 0; + + + for (int x = n+1; x <= 2*n;x++) + { + if ((n * x) % (x-n) == 0) + { + count++; + //cout << "(" << ((n * x) / (x-n)) << "," << x << ") "; } - cout << counter << endl; - - } + } + printf("%d\n", count); + } return 0; } \ No newline at end of file