# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
383622 | nguyen31hoang08minh2003 | Sifra (COCI21_sifra) | C++14 | 1 ms | 364 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define fore(i, a, b) for (int i = (a), _b = (b); i < _b; ++i)
#define fort(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define ford(i, a, b) for (int i = (a), _b = (b); i >= _b; --i)
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define add(x, y) (((x) + (y)) % MOD)
#define sub(x, y) (((x) - (y) + MOD) % MOD)
#define mul(x, y) (1LL * (x) * (y) % MOD)
using namespace std;
using ll = long long;
template<class A, class B> bool maxi(A &a, const B &b) {return (a < b) ? (a = b, true):false;};
template<class A, class B> bool mini(A &a, const B &b) {return (a > b) ? (a = b, true):false;};
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
const int maxN = 105, MOD = 1e9 + 2003, base = 2003;
int n;
char s[maxN];
set<int> numbers;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> s + 1;
n = strlen(s + 1);
for (int i = 1; i <= n;) {
while (i <= n && !isdigit(s[i]))
++i;
if (i > n)
break;
int x = 0;
while (i <= n && isdigit(s[i]))
x = add(mul(x, base), s[i++]);
numbers.insert(x);
}
cout << sz(numbers) << '\n';
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |