//nie mam czasu na nic innego poza brutem :c
#include <bits/stdc++.h>
using namespace std;
int main()
{
cin.tie(0)->sync_with_stdio(0);
string a, b, c;
cin >> a >> b >> c;
int n = a.size();
long long res = 0;
for (int i = 0; i < n; i++)
{
int d = 0;
for (int j = i; j < n; j++)
{
int x = (a[j] - 48) + (b[j] - 48) + d;
if (x % 10 != (c[j] - 48)) break;
if(x >= 10) d = 1;
else d = 0;
if (d == 0)
res++;
}
}
cout << res;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | //nie mam czasu na nic innego poza brutem :c #include <bits/stdc++.h> using namespace std; int main() { cin.tie(0)->sync_with_stdio(0); string a, b, c; cin >> a >> b >> c; int n = a.size(); long long res = 0; for (int i = 0; i < n; i++) { int d = 0; for (int j = i; j < n; j++) { int x = (a[j] - 48) + (b[j] - 48) + d; if (x % 10 != (c[j] - 48)) break; if(x >= 10) d = 1; else d = 0; if (d == 0) res++; } } cout << res; } |
English