Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

农夫约翰你在大学主修数学,喜欢数学,就不能加强一下数据吗?

Posted by sand_and_water at 2024-07-16 20:55:58 on Problem 2140
//暴力解
#include<iostream>
using namespace std;

int n; 
int cnt, abc;
int ans;

int main(){
	cin >> n;
	
	for(int i = 1; i <= n; ++i){
		cnt = 0, abc = i;
		while(cnt < n && abc > 0){
			cnt += abc;
			--abc;
		}
		if(cnt == n){
			++ans;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator