結果
問題 | No.207 世界のなんとか |
ユーザー |
![]() |
提出日時 | 2018-02-28 11:23:13 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 881 bytes |
コンパイル時間 | 646 ms |
コンパイル使用メモリ | 77,048 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-17 17:08:49 |
合計ジャッジ時間 | 1,278 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
// No.207 世界のなんとか// https://yukicoder.me/problems/no/207//#include <iostream>#include <vector>#include <algorithm>#include <sstream>using namespace std;vector<int> solve(int A, int B);int main() {int A, B;cin >> A >> B;vector<int> ans = solve(A, B);for (auto a: ans)cout << a << endl;}vector<int> solve(int A, int B) {vector<int> ans; // 該当する数字の格納用for (auto i = A; i <= B; i++) { // A以上~B以下の数字について、該当するかチェックif (i % 3 == 0) // 3の倍数ans.push_back(i);else {stringstream ss;ss << i;string tmp = ss.str();if (find(tmp.begin(), tmp.end(), '3') != tmp.end()) // 3が付く数字ans.push_back(i);}}return ans;}