1.18每日总结

一 早上

1 看大话数据结构  了解二叉树的遍历 (2h)

二 下午和晚上

1 做洛谷题 (4h)二叉树

#include <bits/stdc++.h>

using namespace std;

int n;
string a;

int main ()
{
	cin >> n;
	cin >> a;
	for (int i = 2;i <= n;i ++){
		string aa;
		cin >> aa;
		int x = a.find(aa[0]);
		a.erase(x,1);
		a.insert(x,aa);
		
	}
	
	for (int i = 0;i < a.size();i ++){
		if(a[i] != '*'){
			cout << a[i];
		}
		else {
			continue;
		}
	}
	return 0;
}

 

#include <bits/stdc++.h>

using namespace std;

int main ()
{
	
	int cnt = 1;
	string a, b;
	cin >> a >> b;
	
	for (int i = 0 ;i < a.size();i ++){
		for (int j = 1;j < a.size();j ++){
			if (a[i] == b[j] && a[i + 1] == b[j - 1]){
				cnt *= 2;
			}
		}
	}
	cout << cnt;
	
	return 0;
}

 

#include <bits/stdc++.h>

using namespace std;

const int  Max = 1e6 + 10;;

struct node {
	int l;
	int r;
}a[Max];

int maxn = 0;
void dfs (int root,int step)
{
	if(root == 0){
		return ;
	}
	maxn = max(maxn,step);
	dfs(a[root].l,step + 1);
	dfs(a[root].r,step + 1);
	
}

int main ()
{
	int n;
	cin >> n;
	for (int i = 1;i <= n;i ++){
		cin >> a[i].l >> a[i].r;
	}
	dfs(1,1);
	cout << maxn;
	return 0;
}

 三 晚上

 Platforms

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main ()
{
	ll n, d, m, l, cnt;
	cin >> n >> d >> m >> l;
	for (ll i = 1; i <= n;i ++){
		if(cnt < (i - 1) * m)	break;
		while(cnt <= (i - 1) * m + l){
			cnt = (((i - 1) * m + l) / d) * d + d;
		}
	}
	cout << cnt;
	return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值