http://poj.org/problem?id=2140
Description
Input
Output
Sample Input
15
Sample Output
4
ps:consecutive 连续地
水题.....一次过
//{头文件 #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; //}头文件 double N; bool f(int n) //n为几个数组相连 { double n0 = n,k = N / n0; int t = k; if( n%2 ){ if(t == k){ if(t - n/2 > 0)return true; } } else { if( t * n + n/2 == N){ if(t + 1 - n/2 >0)return true; } } return false; } int main() { cin >> N; int T = 1; for(int i = 2; i < N/2;i++){ if(f(i))T++; } cout << T <<endl; //system("pause"); return 0; }
原文:http://www.cnblogs.com/farewell-farewell/p/5500536.html