#A
#include <iostream>
#include <string>
using namespace std;
bool xorf(bool a, bool b) {
return a == b ? false : true;
}
int main() {
string input1, input2;
cin >> input1 >> input2;
bool a = (input1 == "true");
bool b = (input2 == "true");
bool result = xorf(a, b);
if(result){
cout << "true";
}else{
cout << "false";
}
return 0;
}
#B
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 0; i <= n; i++) {
cout << pow(2, i) << " ";
}
return 0;
}
#C
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
int main() {
float a;
cin >> a;
if(fmod(a, 2) == 0){
cout << "true";
}else{
cout << "false";
}
return 0;
}
#D
#include <iostream>
#include <string>
using namespace std;
int main(){
string str;
getline(cin, str);
int i = 0;
std::string result = "";
while(i < str.length())
{
if(str[i] != '!'){
result += str[i];
}
i++;
}
cout << result;
}
#E
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
string sa(const string &str)
{
istringstream stm(str);
string token, maxString;
long maxValue = 0;
auto GetValue = [](const string &s)
{
long r = 0;
for (auto c : s)
r += int(c) - int('a') + 1;
return r;
};
while (getline(stm, token, ' '))
{
long actValue = GetValue(token);
if (actValue > maxValue)
{
maxValue = actValue;
maxString = token;
}
}
return maxString;
}
int main()
{
string input;
getline(cin, input);
string result = sa(input);
cout <<result << endl;
return 0;
}
#F
from math import*
n=int(input())
b=isqrt(n)
print(b)
#G
#include <iostream>
using namespace std;
int solve(long long n) {
long long p = 1;
if (n < 10) { return 0; }
while (n > 0) { p = (n % 10) * p; n = n/10; }
return solve(p) + 1;
}
int main() {
long long num;
cin >> num;
cout << solve(num) << endl;
return 0;
}
#H
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int rearrangeDigits(int n) {
string str = to_string(n);
sort(str.begin(), str.end(), greater<char>());
return stoi(str);
}
int main() {
int n;
cin >> n;
cout << rearrangeDigits(n) << endl;
return 0;
}
#I
#include <iostream>
#include <vector>
#include <string>
using namespace std;
bool isValidSmiley(const string& face) {
if (face.length() == 2) {
return (face[0] == ':' || face[0] == ';') && (face[1] == ')' || face[1] == 'D');
} else if (face.length() == 3) {
return (face[0] == ':' || face[0] == ';') && (face[1] == '-' || face[1] == '~') && (face[2] == ')' || face[2] == 'D');
}
return false;
}
int countSmileys(vector<string>& arr) {
int count = 0;
for (const auto& face : arr) {
if (isValidSmiley(face)) {
count++;
}
}
return count;
}
int main() {
vector<string> faces;
string face;
while (cin >> face && face != "exit") {
faces.push_back(face);
}
cout <<countSmileys(faces) << endl;
return 0;
}