跳到正文

题解

急救 - TianX 的做题计划 - 第三章题解

#SUSPENDED#约 7 分钟
原文

这是 2026年5月13日 存档的第 1 版,不是当前版本。查看当前版本

文章信息与版本

文章信息

发布
2026年5月9日
收录
2026年5月13日
更新
2026年11月16日
篇幅
约 7 分钟
获赞
1

版本

  1. v3当前
  2. v2
  3. v1

Red

B3960

C++
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define Moonlight return
#define whispers 0
int n;
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	cin>>n;
	if(n<=99) cout<<n;
	else if(n<=199) cout<<n-20;
	else cout<<n-70;
	Moonlight whispers/*月光私语*/;
}
/*
I frequently reminisce about the past,
please,go back to the beginning

望舒影里,碧落随星际,依记那年春光里,郁香予我情谊。
本愿终生厮守,奈何苍天难求,郁香花开遍野,却见你的芳容。

夏夜已逝,彼时蓝星。

终有一日,星尘淬剑,长夜铮然开曙色;
便倾我心,烛照山河,独向苍茫颂春秋。
*/

B3970

C++
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define Moonlight return
#define whispers 0
int n,k;
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	cin>>n>>k;
	cout<<(n/1000%10%k)*1000+(n/100%10%k)*100+(n/10%10%k)*10+(n/1%10%k);
	Moonlight whispers/*月光私语*/;
}
/*
I frequently reminisce about the past,
please,go back to the beginning

望舒影里,碧落随星际,依记那年春光里,郁香予我情谊。
本愿终生厮守,奈何苍天难求,郁香花开遍野,却见你的芳容。

夏夜已逝,彼时蓝星。

终有一日,星尘淬剑,长夜铮然开曙色;
便倾我心,烛照山河,独向苍茫颂春秋。
*/

B3984

C++
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define Moonlight return
#define whispers 0
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int a,b;
	cin>>a>>b;
	cout<<((b-a)%2==0?(b-a)/2:(b-a)/2+1);
	Moonlight whispers/*月光私语*/;
}
/*
I frequently reminisce about the past,
please,go back to the beginning

望舒影里,碧落随星际,依记那年春光里,郁香予我情谊。
本愿终生厮守,奈何苍天难求,郁香花开遍野,却见你的芳容。

夏夜已逝,彼时蓝星。

终有一日,星尘淬剑,长夜铮然开曙色;
便倾我心,烛照山河,独向苍茫颂春秋。
*/

B4026

C++
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define Moonlight return
#define whispers 0
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a+b<c+d) cout<<"Yes";
	else cout<<"No";
	Moonlight whispers/*月光私语*/;
}
/*
I frequently reminisce about the past,
please,go back to the beginning

望舒影里,碧落随星际,依记那年春光里,郁香予我情谊。
本愿终生厮守,奈何苍天难求,郁香花开遍野,却见你的芳容。

夏夜已逝,彼时蓝星。

终有一日,星尘淬剑,长夜铮然开曙色;
便倾我心,烛照山河,独向苍茫颂春秋。
*/

B4052

C++
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define Moonlight return
#define whispers 0
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int t,a,b,c,d;
	cin>>t>>a>>b>>c>>d;
	if(t==0) cout<<a+b;
	else cout<<max(a-c,1ll*0)+max(b-d,1ll*0);
	Moonlight whispers/*月光私语*/;
}
/*
I frequently reminisce about the past,
please,go back to the beginning

望舒影里,碧落随星际,依记那年春光里,郁香予我情谊。
本愿终生厮守,奈何苍天难求,郁香花开遍野,却见你的芳容。

夏夜已逝,彼时蓝星。

终有一日,星尘淬剑,长夜铮然开曙色;
便倾我心,烛照山河,独向苍茫颂春秋。
*/

Orange

B3627

C++
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define Moonlight return
#define whispers 0
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	cout<<(int)cbrt(n);
	Moonlight whispers/*月光私语*/;
}
/*
I frequently reminisce about the past,
please,go back to the beginning

望舒影里,碧落随星际,依记那年春光里,郁香予我情谊。
本愿终生厮守,奈何苍天难求,郁香花开遍野,却见你的芳容。

夏夜已逝,彼时蓝星。

终有一日,星尘淬剑,长夜铮然开曙色;
便倾我心,烛照山河,独向苍茫颂春秋。
*/

P2695

C++
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define Moonlight return
#define whispers 0
const int maxn=1e5+5;
int n,m,a[maxn],b[maxn],p=1,f,sum;
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	cin>>n>>m;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=m;i++) cin>>b[i];
	sort(a+1,a+n+1);
	sort(b+1,b+m+1);
	for(int i=1;i<=m;i++){
		if(b[i]>=a[p]) sum+=b[i],p++;
		if(p==n+1){f=1;break;}
	}
	if(f==1) cout<<sum;
	else cout<<"you died!";
	Moonlight whispers/*月光私语*/;
}
/*
I frequently reminisce about the past,
please,go back to the beginning

望舒影里,碧落随星际,依记那年春光里,郁香予我情谊。
本愿终生厮守,奈何苍天难求,郁香花开遍野,却见你的芳容。

夏夜已逝,彼时蓝星。

终有一日,星尘淬剑,长夜铮然开曙色;
便倾我心,烛照山河,独向苍茫颂春秋。
*/