답안 #310192

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
310192 2020-10-06T07:46:58 Z LifeHappen__ Nadan (COCI18_nadan) C++14
50 / 50
1 ms 384 KB
#include <bits/stdc++.h>

using namespace std;

#define ar array
#define ii pair<int, int>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(a) begin(a), end(a)

const int N = 1e5 + 5;

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);

  #define task "nadan"
  if(fopen(task".inp", "r")) {
    freopen(task".inp", "r", stdin);
    freopen(task".out", "w", stdout);
  }

  int n, k;
  cin >> k >> n;
  for (int i = 1; i < n; ++i) {
    cout << i << '\n';
    k -= i;
  }
  cout << k << '\n';
}

Compilation message

nadan.cpp: In function 'int32_t main()':
nadan.cpp:21:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   21 |     freopen(task".inp", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
nadan.cpp:22:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   22 |     freopen(task".out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 0 ms 256 KB Output is correct