To zadanie jest łatwe!
#include <iostream>
#include <string>
int main()
{
int num;
std::cin >> num;
while (num--)
{
std::string tag1,tag2;
std::cin >> tag1 >> tag2;
std::string train = "";
for (const auto &i : tag2)
{
auto index = tag1.find(i);
if (index == std::string::npos)
break;
train += i;
tag1.erase(0, index);
}
if (train == tag2)
std::cout << "Tak" << std::endl;
else
std::cout << "Nie" << std::endl;
}
return 0;
}
Śnieg
#include <iostream>
int main()
{
unsigned long long a, b, c, s;
std::cin >> a >> b >> c >> s;
s *= 100;
unsigned long long min;
min = a;
if (b < a)min = b;
if (c < b)min = c;
unsigned a1 = 0, b1 = 0, c1 = 0;
unsigned count = 0;
for (auto i = 0;i <= s;i += min)
{
a1 += a;
b1 += b;
c1 += c;
if (a1 == b1)
count++;
if (a1 == c1)
count++;
if (b1 == c1)
count++;
}
std::cout << count;
return 0;
}
Nie chce gotowych rozwiazan, potrzebuje testow, dla ktorych program zle dziala.