結果
| 問題 |
No.115 遠足のおやつ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-14 12:21:44 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 884 bytes |
| コンパイル時間 | 785 ms |
| コンパイル使用メモリ | 89,476 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2025-01-03 01:33:52 |
| 合計ジャッジ時間 | 1,982 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 |
ソースコード
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>
#include <fstream>
#include <cassert>
//#include <bits/stdc++.h>
using namespace std;
//#include<bits/stdc++.h>
int main() {
int a, b, c;
cin >> a >> b >> c;
vector<int>p;
int s = 0;
for (int i = 1; i <= a; i++) {
if (c == 0)break;
int x = s + i*c + c*(c - 1) / 2;
int y = s + i + a*(c - 1) -(c-2)*(c-1)/2;
if (x <= b&&b <= y) {
s += i;
c--;
p.push_back(i);
}
}
if (c) { cout << -1 << endl; return 0; }
for (int i = 0; i < p.size(); i++) {
if (i)cout << " ";
cout << p[i];
}
cout << endl;
return 0;
}