Source Code Status Test Cases
    Policy: public     Reviewed: 0    
00.00 sec    1156 KB    37 lines     467 bytes    2014-06-02 17:19
#include <iostream>
#include <cstdio>
#include <vector>
#include <array>
#include <algorithm>

using namespace std;

int main() {
	while (true) {
		int n;
		cin >> n;

		if (n == 0) break;

		if (n == 1) continue;

		int head = 1;
		int tail = 0;
		long long sum = 1;
		long long count = 0;

		while (tail!=n) {
			if (sum <= n) {
				if (sum == n) ++count;
				++head;
				sum += head;
			} else {
				sum -= tail;
				++tail;
			}
		}

		cout << count << endl;
	}
}

Compile Error Logs:
You are not authorized to see the message.

Status
Judge: 0/1 C++11 CPU: 00.00 sec Memory: 1156 KB Length: 467 B 2014-06-02 17:19 2014-06-02 17:19
Results for testcases
Case # Verdict CPU Time Memory In Out Case Name
Case #1: : Wrong Answer 00.00 sec 1156 KB
< prev | / | next >  
 
Judge Input #  ( | ) Judge Output #  ( | )


Comments
 
 Under Construction.
 
Categories
 
 
Free Tags