답안 #472144

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
472144 2021-09-13T08:07:24 Z _L__ Nadan (COCI18_nadan) C++17
50 / 50
1 ms 224 KB
// This code is written by _L__
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define endl '\n'
template<class T> using ordered_set = tree<T, null_type , less<T> , rb_tree_tag , tree_order_statistics_node_update>;
#define F_word ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
typedef long long ll;
typedef long double ld;
const ll mod = 1e9+7, N = 1e5+2, INF = 1e18;
const ld E = 1e-6;
#define ff first
#define ss second

ll f[N];
int add(int a, int b) { return a + b - (a + b >= mod) * mod; }
int sub(int a, int b) { return a - b + (a - b < 0) * mod; }
int mul(int a, int b) { return (1ll * a * b) % mod; }
int powM(int n, int p) { return (!p ? 1 : (p & 1) ? mul(n, powM(n, p - 1)) : powM(mul(n, n), p / 2)); }
int divM(int a, int b) { return mul(a, powM(b, mod - 2)); }
int choose(int n, int k) { return divM(f[n], mul(f[n - k], f[k])); }
int per(int n, int k) { return divM(f[n], f[n - k]); }

int main(void){
    F_word;
    ll n, k; cin >> k >> n;
    int c = 1;
    --n;
    while(n--){
        cout << c << endl;
        k-=c;
        ++c;
    }
    cout << k << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 224 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct