您当前的位置: 首页 > 

MangataTS

暂无认证

  • 4浏览

    0关注

    423博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

小红的记谱法(模拟+前缀和)

MangataTS 发布时间:2022-02-09 12:01:31 ,浏览量:4

题目链接

https://ac.nowcoder.com/acm/contest/23479/F

题面

在这里插入图片描述

思路

我们每次遇到一个就自减1,然后每次遇到一个字符的时候,我们就看现在的权值是多少

  • 大于等于0,那么我们直接在后面添加这么多的低音即.就好了
  • 如果小于0,那么我们直接在后面添加负的这么多高音即*就好了
代码
#include
using namespace std;
//----------------自定义部分----------------
#define ll long long
#define mod 1000000007
#define endl "\n"
#define PII pair
#define INF 0x3f3f3f3f

int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1};

ll ksm(ll a,ll b) {
	ll ans = 1;
	for(;b;b>>=1LL) {
		if(b & 1) ans = ans * a % mod;
		a = a * a % mod;
	}
	return ans;
}

ll lowbit(ll x){return -x & x;}

const int N = 2e6+10;
//----------------自定义部分----------------
int n,m,q,a[N];
map to;

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	std::cout.tie(nullptr);
	to['C'] = '1';
	to['D'] = '2';
	to['E'] = '3';
	to['F'] = '4';
	to['G'] = '5';
	to['A'] = '6';
	to['B'] = '7';
	string s;
	cin>>s;
	n = s.size();
	string ans="";
	int res = 0;
	for(int i = 0;i = 0){
				for(int i = 1;i = res; --i) {
					ans += '*';
				}
			}
		}
	}
	cout            
关注
打赏
1665836431
查看更多评论
0.1169s