Submission #991809


Source Code Expand

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n;
    cin >> n;
    ll i = 0;
    while ((i+1)*(i+2)/2 <= n) i++;
    int m = n-i*(i+1)/2;
    REP(j,i-m) cout << j+1 << " ";
    REP(j,m) cout << i-m+j+2 << " ";
    cout << endl;

    return 0;
}#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n;
    cin >> n;
    ll i = 0;
    while ((i+1)*(i+2)/2 <= n) i++;
    int m = n-i*(i+1)/2;
    REP(j,i-m) cout << j+1 << " ";
    REP(j,m) cout << i-m+j+2 << " ";
    cout << endl;

    return 0;
}

Submission Info

Submission Time
Task B - Exactly N points
User TangentDay
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1564 Byte
Status CE

Compile Error

./Main.cpp:38:2: error: stray ‘#’ in program
 }#include <iostream>
  ^
./Main.cpp:38:3: error: ‘include’ does not name a type
 }#include <iostream>
   ^
./Main.cpp: In function ‘int main()’:
./Main.cpp:64:5: error: redefinition of ‘int main()’
 int main() {
     ^
./Main.cpp:27:5: note: ‘int main()’ previously defined here
 int main() {
     ^