• <input id="auww4"></input>
  • <input id="auww4"><acronym id="auww4"></acronym></input>
  • <input id="auww4"><u id="auww4"></u></input>
    <object id="auww4"><acronym id="auww4"></acronym></object>
    <menu id="auww4"></menu><input id="auww4"><u id="auww4"></u></input>
    <input id="auww4"><u id="auww4"></u></input>
  • F.A.Q
    Hand In Hand
    Online Acmers
    Forum | Discuss
    Statistical Charts
    Problem Archive
    Realtime Judge Status
    Authors Ranklist
     
         C/C++/Java Exams     
    ACM Steps
    Go to Job
    Contest LiveCast
    ICPC@China
    Best Coder beta
    VIP | STD Contests
    Virtual Contests
        DIY | Web-DIY beta
    Recent Contests
    Author ID 
    Password 
     Register new ID

    Re:等差數列求和公式。。。。。學到了!

    Posted by FutureStruggle at 2019-12-02 20:17:34 on Problem 2058
    (42)  


    #include <iostream> 
    #include <cmath>
    #include <iomanip>
    #include <string>
    using namespace std;
    int main(void)
    {
    	//cout<<fixed<<setprecision(2);
    	int N,m;
    	while(cin>>N>>m && N||m)
    	{
    		for(int n=sqrt(2*m);n>=1;n--)
    		{
    			int a=(m-((n-1)*n)/2)/n;
    			if(m==a*n+(n*(n-1))/2)
    			cout<<'['<<a<<','<<a+n-1<<']'<<endl;
    		}
    		cout<<endl;
    	}
    	return 0;
    }
    ----------------------------------------------------------------------------------


    Post your reply here:

    Author ID
    Password
    Title
    Content  
     
    Hangzhou Dianzi University Online Judge 3.0
    Copyright © 2005-2020 HDU ACM Team. All Rights Reserved.
    Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
    Total 0.000000(s) query 4, Server time : 2020-11-09 02:27:35, Gzip enabled
    棋牌