//The error code is as follows:#include <stdio.h>#include<math.h>intMain () {inti,n,m,k,t,s; while(SCANF ("%d%d", &n,&m) && (n| |m)) {s=(int) sqrt (Double)2*m); if(n<s) k=N; Elsek=s; for(; k>=0; k--) if(m*2% (k +1)==0) {T=m*2/(k +1)-K; if(t%2==0&&t>0&&t<=2*N) {//if (t/2+k>n)//continue;printf"[%d,%d]\n", t/2, t/2+k); }} printf ("\ n"); } }
//Correct code:/*I say : The way to do this is a condition that slowly reduces the steps of the operation. 1: First find out the longest continuous sum of the length of how much. If n and how much should be compared to who is the youngest to choose. 2:*/#include<stdio.h>#include<math.h>intMain () {inti,n,m,k,t,s; while(SCANF ("%d%d", &n,&m) && (n| |m)) {s=(int) sqrt (Double)2*m); if(n<s) k=N; Elsek=s; for(; k>=0; k--) if(m*2% (k +1)==0) {T=m*2/(k +1)-K; if(t%2==0&&t>0&&t<=2*N) {if(t/2+k>N)Continue; printf ("[%d,%d]\n", t/2, t/2+k); }} printf ("\ n"); } }
__________________________________________________2058_________________________________________ background data is not enough. may be misjudged.