1) #include <iostream>
#include <set>
#include <vector>
using namespace std;
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
string a,b;
cin >> a >> b;
if(tolower(a[0]) == tolower(b[b.length()-1]))
cout << "YES";
cout << "NO"
2)
#include <iostream>
#include <set>
#include <vector>
using namespace std;
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
string a,b;
string s = "tros";
reverse(s.begin(),s.end());
cout << s << "\n";
for(int i = s.length()-1; i >= 0; i -= 2)
cout << s[i];
for(int i = s.length()-2; i >= 0; i -= 2)
cout << s[i];
cout << "\n";
cout << s[2] << s[1] << s[0] << s[3];
3)
#include <iostream>
#include <set>
#include <vector>
using namespace std;
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
string s;
set<int> st;
for(int i = 0; i < 10; i++)
st.insert(i);
getline(cin,s);
for(
if(st.find(int(i)-48) != st.end())
cout << "YES";
return 0;
cout << "NO";
50 div 9 = 5
-10 mod (-5) = 0
round (9.5) = 10
trunc (15.6) = 15
Объяснение:
50 / 9 = 5 целых + 5 остаток
div - результат целочисленного деления
50 div 9 = 5
-10 / (-5) = 2 целых + 0 остаток
mod - остаток от целочисленного деления
-10 mod (-5) = 0
round - округленное до ближайшего целого, если вещественное число находится посередине между двумя целыми, то округление происходит к ближайшему чётному (round (2,5) = 2, round (3,5) = 4)
round (9.5) = 10
trunc - возвращает целую часть вещественного числа
trunc (15.6) = 15
1) #include <iostream>
#include <set>
#include <vector>
using namespace std;
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
string a,b;
cin >> a >> b;
if(tolower(a[0]) == tolower(b[b.length()-1]))
cout << "YES";
else
cout << "NO";
}
2)
#include <iostream>
#include <set>
#include <vector>
using namespace std;
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
string a,b;
string s = "tros";
reverse(s.begin(),s.end());
cout << s << "\n";
for(int i = s.length()-1; i >= 0; i -= 2)
cout << s[i];
for(int i = s.length()-2; i >= 0; i -= 2)
cout << s[i];
cout << "\n";
cout << s[2] << s[1] << s[0] << s[3];
}
3)
#include <iostream>
#include <set>
#include <vector>
using namespace std;
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
string s;
set<int> st;
for(int i = 0; i < 10; i++)
st.insert(i);
getline(cin,s);
for(auto i: s)
{
if(st.find(int(i)-48) != st.end())
{
cout << "YES";
return 0;
}
}
cout << "NO";
}