Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
好吧。。。水题,附代妈//============================================================================ // Name : main1032.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> #include <cmath> using namespace std; int main() { int N; cin >> N; int n = (int)((-1+sqrt(8*N+9.0))/2); //cout << n; int dif = N + 1 - n*(n+1)/2; if(dif < n){ for(int i = 2; i < n+2; i++){ if(i != n+1-dif) cout << i << " "; } } else{ for(int i = 3; i < n+1; i++){ cout << i << " "; } cout << n+2; } //cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!! return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator