// PATn.cpp : 定義控制臺應用程序的入口點。
//
#include "stdafx.h"
#include<iostream>
#include<string>
#include<vector>
using namespace std;
string format(string s)
{
auto tmp = 3 - s.size();
if (tmp > 0)
{
s = string(tmp, '0') + s;
}
return s;
}
string change_color(unsigned s, unsigned a, unsigned b, string tc)
{
if (a <= s && s <= b)
{
return tc;
}
else
{
return format(to_string(s));
}
}
int main()
{
unsigned m, n;
unsigned a, b;
string to_color;
cin >> m >> n >> a >> b >> to_color;
to_color = format(to_color);
vector<vector<string>> format_color(m,vector<string>(n,""));
for (unsigned i = 0; i < m; ++i)
{
for (unsigned j = 0; j < n; ++j)
{
unsigned tmp;
cin >> tmp;
auto tmp_color = change_color(tmp, a, b, to_color);
format_color[i][j] = tmp_color;
}
}
for (size_t i = 0; i < format_color.size(); ++i)
{
for (size_t j = 0; j < format_color[i].size(); ++j)
{
cout << format_color[i][j];
if (j != (format_color[i].size() - 1))
cout << " ";
}
if (i != (format_color.size() - 1))
{
cout << endl;
}
}
system("pause");
return 0;
}
1066
最后編輯于 :
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。
推薦閱讀更多精彩內容
- 由碧水寒心(北京碧水寒心文化傳媒有限公司)出品、炫動影業(北京炫動映像影視傳媒有限公司)獨家營銷發行的懸疑燒腦電影...