__________________________________________________2058_________________________________________ background data is not enough. may be misjudged.

Source: Internet
Author: User

//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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.