1024 Palindromic Number
更多...
|
int | main (istream &cin, ostream &cout) |
|
ostream & | operator<< (ostream &os, bi &b) |
|
| TEST (a1024, case1) |
|
| TEST (a1024, case2) |
|
| TEST (a1024, case3) |
|
◆ main()
int pat::a::a1024::main |
( |
istream & | cin, |
|
|
ostream & | cout ) |
在文件 pat.cpp 第 4926 行定义.
4926 {
4927 string n;
4928 unsigned int k;
4929 cin >> n >> k;
4931 unsigned step = 0;
4932 while(step <= k) {
4933 if(bn.is_palindromic()) {
4934 cout << bn << endl
4935 << step;
4936 return 0;
4937 }
4938 if(step == k) {
4939 break;
4940 }
4941 bi bn2 = bn;
4942 bn2.reverse();
4943 bn = bn + bn2;
4944 step++;
4945 }
4946 cout << bn << endl
4947 << step;
4948 return 0;
4949 }
引用了 pat::a::a1024::bi::is_palindromic() , 以及 pat::a::a1024::bi::reverse().
被这些函数引用 TEST(), TEST() , 以及 TEST().
◆ operator<<()
ostream & pat::a::a1024::operator<< |
( |
ostream & | os, |
|
|
bi & | b ) |
在文件 pat.cpp 第 4951 行定义.
4951 {
4952 for(
auto it =
b.vec.rbegin(); it !=
b.vec.rend(); ++it) {
4953 os << *it;
4954 }
4955 return os;
4956 }
◆ TEST() [1/3]
pat::a::a1024::TEST |
( |
a1024 | , |
|
|
case1 | ) |
在文件 pat_test.cpp 第 2221 行定义.
2221 {
2222 istringstream in("67 3");
2223 auto out = ostringstream();
2225 ASSERT_EQ("484\n"
2226 "2",
2227 out.str());
2228 }
int main(istream &cin, ostream &cout)
引用了 main().
◆ TEST() [2/3]
pat::a::a1024::TEST |
( |
a1024 | , |
|
|
case2 | ) |
在文件 pat_test.cpp 第 2230 行定义.
2230 {
2231 istringstream in("69 3");
2232 auto out = ostringstream();
2234 ASSERT_EQ("1353\n"
2235 "3",
2236 out.str());
2237 }
引用了 main().
◆ TEST() [3/3]
pat::a::a1024::TEST |
( |
a1024 | , |
|
|
case3 | ) |
在文件 pat_test.cpp 第 2239 行定义.
2239 {
2240 istringstream in("7237160004 37");
2241 auto out = ostringstream();
2243 ASSERT_EQ("93682709897533470989727738\n"
2244 "37",
2245 out.str());
2246 }
引用了 main().