大佬的C学习了
大佬的 D学习了
AtCoder Beginner Contest 190
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;//ans[1]
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;
}
C Bowls and Dishes(暴搜)
题解传送门
D Staircase Sequences(唯一分解&&求因子数)
题解传送门
E Magical Ornament
题解传送门
F - Shift and Inversions(逆序数&&树状数组&&优化)
题解传送门