problemscpp
A collection of my answers to algorithm problems in c++.
载入中...
搜索中...
未找到
luogu::P5727类 参考

洛谷 P5727 【深基5.例3】冰雹猜想 更多...

#include <luogu.h>

静态 Public 成员函数

static int main (istream &cin, ostream &cout)
 

详细描述

洛谷 P5727 【深基5.例3】冰雹猜想

在文件 luogu.h383 行定义.

成员函数说明

◆ main()

int luogu::P5727::main ( istream & cin,
ostream & cout )
static

在文件 luogu.cpp1125 行定义.

1125 {
1126 int n;
1127 cin >> n;
1128 auto vec = vector<int>();
1129 while(n != 1) {
1130 vec.push_back(n);
1131 if(n % 2 != 0) {
1132 n = n * 3 + 1;
1133 } else {
1134 n /= 2;
1135 }
1136 }
1137 vec.push_back(n);
1138 for(auto i = vec.rbegin(); i != vec.rend(); ++i) {
1139 cout << *i << " ";
1140 }
1141 return 0;
1142 }
int vec[100010]

被这些函数引用 luogu::TEST().


该类的文档由以下文件生成: