QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#398233 | #3754. Numbers | SamponYW | AC ✓ | 26ms | 4008kb | C++14 | 1.4kb | 2024-04-25 09:20:08 | 2024-04-25 09:20:10 |
Judging History
answer
#include <bits/stdc++.h>
#define db double
#define il inline
#define re register
#define ll long long
#define ui unsigned
#define ull ui ll
#define i128 __int128
#define pii pair<int, int>
#define fi first
#define se second
#define eb emplace_back
#define SZ(v) (int)v.size()
#define ALL(v) v.begin(), v.end()
#define mems(v, x) memset(v, x, sizeof(v))
#define memc(a, b) memcpy(a, b, sizeof(a))
#define FOR(i, L, R) for(re int i = (L); i <= (R); ++i)
#define ROF(i, R, L) for(re int i = (R); i >= (L); --i)
#define LS i << 1, l, mid
#define RS i << 1 | 1, mid + 1, r
#define popc(x) __builtin_popcount(x)
using namespace std;
#define N 1000005
#define P 1000000007
il int add(int x, int y) {return x + y < P ? x + y : x + y - P;}
il void addr(int &x, int y) {(x += y) >= P && (x -= P);}
string str;
int n, s[N], ans;
bool u[100];
il void dfs(int x) {
if(x > n) {++ans; return ;}
int c = s[x]; if(!u[c]) u[c] = 1, dfs(x + 1), u[c] = 0;
if(x < n) {
int c = s[x] * 10 + s[x + 1];
if(c < 10) return ;
if(!u[c]) u[c] = 1, dfs(x + 2), u[c] = 0;
}
}
il void WORK() {
n = SZ(str), str = " " + str;
FOR(i, 1, n) s[i] = str[i] & 15;
ans = 0, dfs(1), cout << ans << "\n";
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
while(cin >> str) WORK();
cerr << 1.0 * clock() / CLOCKS_PER_SEC;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 26ms
memory: 4008kb
input:
0385596 623829532127833595190856470573136145815442523489 3766945901332141272257649782082688342526804752 196131806875116663514046841347546471452538379741 114804665712451327453562583855203785123521571392 45308531262867824688749760418132337858154164338 81404731326615336971856750588837772991621753879 52...
output:
9 46469 10936 7508 4466 6048 36048 0 6740 0 5850 1 2392 1012 10460 6358 9756 149 0 1766 5945 8131 0 14611 3 10159 5897 12161 11403 8892 0 4386 159 835 3731 7751 0 28118 1982 361 8674 190 9570 15012 362 8634 26 13347 1273 4486 3379 301 0 938 34 14984 14437 4898 0 10590 7848 8 15308 16167 11072 12342 ...
result:
ok 100 numbers