제출 #862625

#제출 시각아이디문제언어결과실행 시간메모리
862625AOrdinaryNadan (COCI18_nadan)C++14
10 / 50
1 ms604 KiB
#include<bits/stdc++.h> #define ld long double #define ss second #define ff first #define int long long #define ull unsigned long long #define all(x) x.begin(), x.end() #define ll long long #define rall(x) x.rbegin(), x.rend() #define sz(a) (int)a.size() #define vll vector<long long> #define pii pair<int, int> #define pll pair<ll, ll> #define yes cout << "YES" << endl; #define no cout << "NO" << endl; #define sp(x) fixed << setprecision(x) #define ms multiset #define pb(x) push_back(x) #define mp(x,y) make_pair(x,y); #define mll map<ll,ll> using namespace std; const string YES = "YES"; const string NO = "NO"; const long long MOD = 1e9 + 7; const int N = 1e5 + 5; const long long inf = 9e18; const int M = 3e3 + 5; const double EPS = 1e-6; const ll neg = -1; const string imp = "impossible"; void setIO(string name = "") { if (sz(name)) { freopen((name + ".in").c_str(), "r", stdin); freopen((name + ".out").c_str(), "w", stdout); } } void boost(){ ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); } void solve(){ ll k,n; cin >> k >> n; ll cnt = 1; if(n == 1){ cout << k; return; } ll sum = 0; vll res; if(n% 2 !=0){ for(ll i = 0;i<n / 2;i++){ res.pb((k/n)+cnt); sum+=(k/n)+cnt; res.pb((k/n) - cnt); sum+=(k/n) - cnt; cnt++; } for(ll i = 0;i<n - 1;i++) cout << res[i] << '\n'; cout << k-sum; }else{ //vll res; for(ll i = 0;i<n / 2;i++){ res.pb((k/n)+cnt); res.pb((k/n) - cnt); cnt++; } for(ll i = 0;i<n;i++) cout << res[i] << '\n'; } //cout << sum; } signed main(){ boost(); ll test = 1; //cin >> test; while(test--) solve(); }

컴파일 시 표준 에러 (stderr) 메시지

nadan.cpp: In function 'void setIO(std::string)':
nadan.cpp:35:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |         freopen((name + ".in").c_str(), "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nadan.cpp:36:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |         freopen((name + ".out").c_str(), "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...