Skip to content

Instantly share code, notes, and snippets.

@jason790228
Last active August 30, 2017 10:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jason790228/c5e92081928571be6259efa17c090655 to your computer and use it in GitHub Desktop.
Save jason790228/c5e92081928571be6259efa17c090655 to your computer and use it in GitHub Desktop.
488
#include <string>
#include <iostream>
int main()
{
std::string peak_table[10] =
{
"",
"1\n\n",
"1\n22\n1\n\n",
"1\n22\n333\n22\n1\n\n",
"1\n22\n333\n4444\n333\n22\n1\n\n",
"1\n22\n333\n4444\n55555\n4444\n333\n22\n1\n\n",
"1\n22\n333\n4444\n55555\n666666\n55555\n4444\n333\n22\n1\n\n",
"1\n22\n333\n4444\n55555\n666666\n7777777\n666666\n55555\n4444\n333\n22\n1\n\n",
"1\n22\n333\n4444\n55555\n666666\n7777777\n88888888\n7777777\n666666\n55555\n4444\n333\n22\n1\n\n",
"1\n22\n333\n4444\n55555\n666666\n7777777\n88888888\n999999999\n88888888\n7777777\n666666\n55555\n4444\n333\n22\n1\n\n"
};
std::string peak_table2[10] =
{
"",
"1\n",
"1\n22\n1\n",
"1\n22\n333\n22\n1\n",
"1\n22\n333\n4444\n333\n22\n1\n",
"1\n22\n333\n4444\n55555\n4444\n333\n22\n1\n",
"1\n22\n333\n4444\n55555\n666666\n55555\n4444\n333\n22\n1\n",
"1\n22\n333\n4444\n55555\n666666\n7777777\n666666\n55555\n4444\n333\n22\n1\n",
"1\n22\n333\n4444\n55555\n666666\n7777777\n88888888\n7777777\n666666\n55555\n4444\n333\n22\n1\n",
"1\n22\n333\n4444\n55555\n666666\n7777777\n88888888\n999999999\n88888888\n7777777\n666666\n55555\n4444\n333\n22\n1\n"
};
int number(0);
std::cin >> number;
for (int i = 0; i < number; i++)
{
int max_peak(0), number_peak(0);
std::cin >> max_peak >> number_peak;
for (int j = 0; j < number_peak-1; j++)
{
std::cout << peak_table[max_peak];
}
(i == (number - 1)) ? std::cout << peak_table2[max_peak] : std::cout << peak_table[max_peak];
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment