传送门 Description Given a sequence 1,2,3,......N, your job is to calculate all the possible sub-sequences that the sum of the sub-sequence is M. Input Input contains multiple test cases. each case contains two integers N, M( 1 <= N, M <= 1000000000).i…
The sum problem Problem Description Given a sequence 1,2,3,......N, your job is to calculate all the possible sub-sequences that the sum of the sub-sequence is M. Input Input contains multiple test cases. each case contains two integers N, M( 1 <=…
The sum problem Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 31453 Accepted Submission(s): 9414 Problem Description Given a sequence 1,2,3,......N, your job is to calculate all the possib…
题目: Given a sequence 1,2,3,......N, your job is to calculate all the possible sub-sequences that the sum of the sub-sequence is M. 思路: 刚开始做写了一个尺取法,脑抽的一批.(这几天心情真的是颓的很,连带脑瓜也不好用了,抓紧调整~~~~) 其实可以根据等差数列求和公式求出这个子序列的长度的一个大致的范围为k=sqrt(2*m),然后根据m和k求出首项a1,然后将a1…