大佬的C学习了
大佬的 D学习了
A Very Very Primitive Game(简单讨论)
两个人吃糖果,A有初始糖果a,B有初始糖果b。
c代表a先吃,还是b先吃。
假如:
现在开始游戏,A吃一个,接着B吃一个。谁最先吃不了糖果就输了。
AC
#include <iostream>
#include <bits/stdc++.h>
#define For(i,x,y) for(int i=(x); i<=(y); i++)
#define fori(i,x,y) for(int i=(x); i<(y); i++)
#define rep(i,y,x) for(int i=(y); i>=(x); i--)
#define mst(x,a) memset(x,a,sizeof(x))
#define pb push_back
#define sz(a) (int)a.size()
#define mp make_pair
#define fi first
#define se second
#define debug(a) cout << #a << ": " << a << endl
using namespace std;
typedef long long ll;
typedef pair<int,int>pa;
typedef pair<ll,ll>pai;
const int N = 2e5+10;
const int M = 1e5;
const string ans[]={"Takahashi","Aoki"};
int main()
{
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int a, b, c;
cin>>a>>b>>c;
if(c==0&&a<=b||c==1&&a<b)cout<<ans[1]<<endl;
else cout<<ans[0]<<endl;
return 0;
}
B Magic 3(O(n)遍历查看)
- 有n个魔法,每个魔法有一个释放时间
x
i
x_i
xi,和伤害
y
i
y_i
yi。
- 现在对一个monster进行攻击,当法术的释放时间大于等于s,或者伤害小于等于d时,怪物不受到伤害。
问:
最后是否可以打败怪物。
AC
#include <iostream>
#include <bits/stdc++.h>
#define For(i,x,y) for(int i=(x); i<=(y); i++)
#define fori(i,x,y) for(int i=(x); i<(y); i++)
#define rep(i,y,x) for(int i=(y); i>=(x); i--)
#define mst(x,a) memset(x,a,sizeof(x))
#define pb push_back
#define sz(a) (int)a.size()
#define mp make_pair
#define fi first
#define se second
#define debug(a) cout << #a << ": " << a << endl
using namespace std;
typedef long long ll;
typedef pair<int,int>pa;
typedef pair<ll,ll>pai;
const int N = 2e5+10;
const int M = 1e5;
const string ans[]={"No","Yes"};
int main()
{
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, s, d;
cin>>n>>s>>d;
bool ok = false;
int x, y;
for(int i = 1; i <= n; i ++ ){
cin>>x>>y;
if(x>=s||d>=y)continue;
ok = true;
}
if(ok)cout<<ans[1]<<'\n';
else cout<<ans[0]<<'\n';
return 0;
}
题解传送门
题解传送门
题解传送门
题解传送门
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)