标签:c++ none ref get codeforce click play sans img
#include <bits/stdc++.h>
using namespace std;
int num[5];
int d;
int main() {
for(int i = 0; i < 3; i ++)
scanf("%d", &num[i]);
scanf("%d", &d);
sort(num, num + 3);
int ans = 0;
if(num[1] - num[0] < d)
ans += d - num[1] + num[0];
if(num[2] - num[1] < d)
ans += d - num[2] + num[1];
printf("%d\n", ans);
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int T;
string s, t;
bool isSubsequence(string s, string t) {
int ls = s.length(), lt = t.length();
if(!ls) return true;
if(!lt && ls) return false;
int pos = 0, temp = 0;
char c = s[pos];
while(pos <= ls && temp <= lt) {
if(s[pos] == t[temp]) {
c = s[pos];
pos ++;
} else {
if(t[temp] != c) return false;
}
temp ++;
}
return pos == ls + 1;
}
int main() {
scanf("%d", &T);
while(T --) {
cin >> s >> t;
if(isSubsequence(s, t)) printf("YES\n");
else printf("NO\n");
}
return 0;
}
被病毒吓到不敢出门 QAQ 废宅好几天重于开始干活辽 接下来打算看书去辽 为开工上班做准备!
标签:c++ none ref get codeforce click play sans img
原文地址:https://www.cnblogs.com/zlrrrr/p/12238136.html