結果
| 問題 | No.542 1円玉と5円玉 |
| コンテスト | |
| ユーザー |
dgd1724
|
| 提出日時 | 2017-08-12 10:41:33 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 634 bytes |
| 記録 | |
| コンパイル時間 | 793 ms |
| コンパイル使用メモリ | 90,572 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-30 11:25:33 |
| 合計ジャッジ時間 | 1,844 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
int main(void) {
//std::ifstream inf("Text.txt"); std::cin.rdbuf(inf.rdbuf());
int A = 0, B = 0;
std::cin >> A >> B;
std::vector<int> ans;
int sum = 0;
for (int i = 0; i <= B; i++) {
sum += 5 * i;
for (int j = 0; j <= A; j++) {
sum += j;
if (sum != 0) {
ans.push_back(sum);
}
sum -= j;
}
sum = 0;
}
std::sort(ans.begin(), ans.end());
ans.erase(std::unique(ans.begin(), ans.end()), ans.end());
for (auto itr = ans.begin(); itr != ans.end(); itr++) {
std::cout << *itr << std::endl;
}
return 0;
}
dgd1724