1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#include <iostream>
#include <cstdlib>
#include <string>
#include <sstream>
#include <vector>
using
namespace
std;
vector<string> strTmp;
int
main()
{
for
(
int
i = 100; i < 1000; i++)
{
if
(i % 2){
ostringstream ost;
ost.sync_with_stdio();
ost << i;
string tmp;
tmp = (ost.str());
if
(tmp.find(
'5'
) == tmp.npos){
strTmp.push_back(tmp);
}
}
}
int
i = 0;
for
(auto p : strTmp){
if
(!(i++ / 10)){
cout << endl;
}
cout << p <<
" "
;
}
cout <<
"一共有: "
<< strTmp.size();
cin.get();
return
0;
}//中间有的东西有点意思可以看看
|
一个小函数,算出100到999之间的所有的不含5 的奇数
最新推荐文章于 2022-08-05 09:36:40 发布