Go to diff to previous submission
#include <stdio.h> #include <vector> using namespace std; int main() { int n; char tmp, tmp2; while(scanf("%c%c%d\n", &tmp, &tmp2, &n) == 3) { int ans = 0; int ans2 = 0; for(int x = 1; x<1000000; x++) { long long prod = x*n; if(x == n) continue; if(prod % (x-n) == 0) { long long y = prod/(x-n); if(y < x) continue;//break; if(x > 0 && y > 0) { if(x == y) ans2++; else ans+=2; } } } printf("%d\n", ans2+ans/2); } }
--- c5.s464.cteam042.fl.cpp.0.fl.cpp +++ c5.s472.cteam042.fl.cpp.0.fl.cpp @@ -8,13 +8,14 @@ int ans = 0; int ans2 = 0; - for(int x = 1; x < 10000*n; x++) { + for(int x = 1; x<1000000; x++) { long long prod = x*n; if(x == n) continue; if(prod % (x-n) == 0) { long long y = prod/(x-n); + if(y < x) continue;//break; if(x > 0 && y > 0) { if(x == y) ans2++; - else ans++; + else ans+=2; } }