AtCoder Beginner Contest 199(Sponsored by Panasonic)
作者:互联网
AtCoder Beginner Contest 199(Sponsored by Panasonic)
导读:
简单的题目,只说明题意,或者直接说明结论
下面的难题,会做详细的解释和证明
立个flag,在座的大佬们做个见证:一个月刷60场ABC,现在2021/6/15,第一天,以打卡1场。
A - Square Inequality
题意:问你aa+bb是不是大于c*c
void work()
{
int a, b, c; cin >> a >> b >> c;
if (a * a + b * b < c * c) cout << "Yes";
else cout << "No";
}
B - Intersection
题目问你满足对任意i,x大于等于a[i]且小于等于b[i]的x有多少个
void work()
{
int n, a = -1e9, b = 1e9;
cin >> n;
for (int i = 0; i < n; i ++ )
{int x; cin >> x; a = max(a, x);}
for (int i = 0; i < n; i ++ )
{int x; cin >> x; b = min(b, x);}
printf("%d\n", b - a + 1 > 0 ? b - a + 1 : 0);
}
C - IPFL
题意:有两种操作,模拟就好了
void work()
{
ios;
int n;
string a, b;
cin >> n >> a;
b = a.substr(n, n);
a = a.substr(0, n);
// cout << a << endl;
// cout << b << endl;
int m; cin >> m;
while (m -- )
{
int p, x, y; cin >> p >> x >> y;
x --, y --;
if (p == 2)
{
swap(a, b);
}
else
{
if (y < n) //都在第一个串内
{
swap(a[x], a[y]);
}
else if (x >= n)
{
x -= n; y -= n;
swap(b[x], b[y]);
}
else
{
swap(a[x], b[y - n]);
// cout << a << endl;
// cout << b << endl;
}
}
}
cout << a << b << endl;
}
话说,AtCoder真的就这么爱考DP的嘛,像我这种老年人最不会的就是DP了,费脑子啊!!!
标签:AtCoder,199,题意,Beginner,int,cin,swap,cout 来源: https://blog.csdn.net/qq_37978559/article/details/117933076