标签:const int memset 构造 字符串 return sizeof define
构造题
1,观察
S
A T A N
不包含
S
A N
T A 包含
/*
hello world!
Just do it!
start time:2022-04-28 09:41:37.863500
*/
// #pragma GCC optimize (2)
// #pragma G++ optimize (2)
#include <bits/stdc++.h>
#define zero(x) memset(x, 0, sizeof(x));
#define one(x) memset(x, -1, sizeof(x));
#define m_INF(x) memset(x, 0x3f, sizeof(x));
#define m_inf(x) memset(x, 0x3f, sizeof(x));
#define m_f_INF(x) memset(x, -0x3f, sizeof(x));
#define m_f_inf(x) memset(x, -0x3f, sizeof(x));
#define all(x) x.begin(), x.end()
#define endl "\n"
#define fi first
#define se second
#define lbt(x) ((x)&(-x))
#define pb push_back
struct cmpl{ template <typename A, typename B> bool operator()(const A &a1, const B &b1) { return b1 < a1; } };
struct cmpg{ template <typename A, typename B> bool operator()(const A &a1, const B &b1) { return a1 < b1; } };
#define p_ql(x) priority_queue<x, vector<x>, cmpl>
#define p_qlp(x, y) priority_queue<pair<x, y>, vector<pair<x, y>>, cmpl>
#define p_qg(x) priority_queue<x, vector<x>, cmpg>
#define p_qgp(x, y) priority_queue<pair<x, y>, vector<pair<x, y>>, cmpg>
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
#define fo(i,from,to) for(int i=(from),ooo=(from)<(to)?1:-1,oooo=(to)+ooo;i!=oooo;i+=ooo)
#define fol(i,from,to) for(long long i=(from),ooo=(from)<(to)?1:-1,oooo=(to)+ooo;i!=oooo;i+=ooo)
#define foo(i,ooo) for(auto i=ooo.rbegin();i!=ooo.rend();++i)
#define foa(i,from,to) for(int i=(from),ooo=(to);i<=ooo;++i)
#define fos(i,from,to) for(int i=(from),ooo=(to);i>=ooo;--i)
using namespace std;
#ifndef LOCAL
# define dbg(...) ;
#endif
#define itn int
#define int long long
#ifdef int
#define inf (0x3f3f3f3f3f3f3f3f)
#else
#define inf (0x3f3f3f3f)
#endif
typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> pii;
const int dir[8][2]={{0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1}}, INF = 0x3f3f3f3f, f_inf = -1044266559, f_INF = -1044266559;
const double eps = 1e-6;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 10;
const int N = 1e6 + 10;
int n, m;
void init()
{
}
string s;
void solve()
{
cin >> s;
string a = "SATAN", b = "SANTA";
// s += "TA";
fos(i, s.length() - 1, 0) {
if(s[i] == 'N') {
s += "TA";
foa(j, 0, i - 1) {
if(s[j] == 'S') {
foa(k, j, i) {
if(s[k] == 'A') return;
}
s.insert(i, "A");
return;
}
}
s.insert(i, "SA");
return;
}
}
s = b + s;
}
signed main()
{
#ifdef LOCAL
freopen("read.in", "r", stdin);
freopen("write.out", "w", stdout);
#endif
std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0);
init();
int t = 0, num2 = 0;
t = 1;
if (!t) cin >> t;
while (t--) {
//cout<<"Case "<<++num2<<": ";
solve();
cout << s << endl;
}
return 0;
int num1 = 0;
//while (scanf("%d", &n) !=-1 && n)
while (cin >> n && n) {
//cout<<"Case "<<++num1<<": ";
solve();
}
return 0;
}
标签:const,int,memset,构造,字符串,return,sizeof,define 来源: https://www.cnblogs.com/hello-acm/p/16202396.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。