diff --git a/HDOJ/Multi-University Training Contest/2017/Team 7/1005_Richard.cpp b/HDOJ/Multi-University Training Contest/2017/Team 7/1005_Richard.cpp new file mode 100644 index 0000000..a75c038 --- /dev/null +++ b/HDOJ/Multi-University Training Contest/2017/Team 7/1005_Richard.cpp @@ -0,0 +1,20 @@ +#include +#include +#include +#include + +using namespace std; + +int main() { + int t; + cin >> t; + while (t--) { + int a; + cin >> a; + if (a % 2 == 1) + cout << (a - 1) / 2 + 2; + else + cout << a / 2 + 1; + cout << endl; + } +} \ No newline at end of file diff --git a/HDOJ/Multi-University Training Contest/2017/Team 7/1011_Richard_Kiritow.cpp b/HDOJ/Multi-University Training Contest/2017/Team 7/1011_Richard_Kiritow.cpp new file mode 100644 index 0000000..548123d --- /dev/null +++ b/HDOJ/Multi-University Training Contest/2017/Team 7/1011_Richard_Kiritow.cpp @@ -0,0 +1,55 @@ +#include +#include +#include +#include +#include +#include +#include +std::vector kolakoski(std::size_t size) { + std::vector vec; + vec.reserve(size); + vec.push_back(1); + vec.push_back(2); + vec.push_back(2); + std::vector::iterator it = vec.begin() + 2; + while (vec.size() < size) { + if (*it == 1) { + if (vec.back() == 1) { + vec.push_back(2); + } + else { //if (vec.back() == 2) { + vec.push_back(1); + } + } + else { //if (*it == 2) { + if (vec.back() == 1) { + vec.push_back(2); + vec.push_back(2); + } + else { //if (vec.back() == 2) { + vec.push_back(1); + vec.push_back(1); + } + } + ++it; + } + return vec; +} + +int main() { + int t; + int n[5]; + int nmax = 0; + std::cin >> t; + for (int i = 0; i < t; i++) { + std::cin >> n[i]; + nmax = std::max(n[i], nmax); + } + std::vector vec = kolakoski((std::size_t)nmax); + //´Ë´¦Êä³ö + for(int i=0;i