답안 #976993

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
976993 2024-05-07T10:10:48 Z batsukh2006 Nadan (COCI18_nadan) C++17
50 / 50
1 ms 848 KB
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<map>
#include<string>
#include<algorithm>
#include<vector>
#include<string.h>
#include<utility>
#include<set>
#include<cmath>
#include<queue>
#include<deque>
#include<functional>
#include<stack>
#include<limits.h>
#include<iomanip>
#include<unordered_map> 
#include<numeric>
#include<tuple>
#include<bitset>
using namespace std;
 
#define MOD 1000000000
#define int long long
#define ff first
#define ss second
#define endl '\n'
void solve(){
	int k,n; cin>>k>>n;
	if(n==1){
		cout<<k;
	}else{
		int sum=0;
		for(int i=1; i<n; i++){
			sum+=i;
			cout<<i<<' ';
		}
		cout<<k-sum;
	}
}
signed main(){
    // freopen("file.in", "r", stdin);
    // freopen("file.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int t=1;
    // cin>>t;
    while(t--){
        solve();
        cout<<endl;
    }
    return 0;
}





















# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 848 KB Output is correct
10 Correct 0 ms 348 KB Output is correct