Go to diff to previous submission
#include<stdlib.h> #include<stdio.h> int main(){ int n; int pole[1000]; char a, b; bool pom = true; while(scanf("%c %c %d \n",&a, &b, &n)==3) { pom = true; int sum = 0; int pocet = 0; for(int y = n+1; y<n*n+2; y++) { //if(y-n > 0) //{ if((n*y)%(y-n)==0) { for(int i = 0; i <pocet; i++) { if(pole[i]==y || pole[i] == (n*y)/(y-n)) { pom = false; break; } } if(pom) { pole[pocet] = y; pole[pocet +1] = (n*y)/(y-n); pocet += 2; sum++; pom = true; } } //} } printf("%d\n", sum); } return 0; }
--- c5.s1040.cteam068.fl.cpp.0.druhy.cpp +++ c5.s1079.cteam068.fl.cpp.0.druhy.cpp @@ -14,9 +14,9 @@ int sum = 0; int pocet = 0; - for(int y = 2; y<n*n+2; y++) + for(int y = n+1; y<n*n+2; y++) { - if(y-n > 0) - { + //if(y-n > 0) + //{ if((n*y)%(y-n)==0) { @@ -40,5 +40,5 @@ } - } + //}