Submission #6689617
Source Code Expand
Copy
#pragma GCC optimize(2) #pragma GCC optimize(3) #include <bits/stdc++.h> #define Fast_cin ios::sync_with_stdio(false), cin.tie(0); #define rep(i, a, b) for(register int i = a; i <= b; i++) #define per(i, a, b) for(register int i = a; i >= b; i--) using namespace std; typedef unsigned long long ull; typedef pair <int, int> pii; typedef long long ll; template <typename _T> inline void read(_T &f) { f = 0; _T fu = 1; char c = getchar(); while(c < '0' || c > '9') { if(c == '-') fu = -1; c = getchar(); } while(c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar(); } f *= fu; } template <typename T> void print(T x) { if(x < 0) putchar('-'), x = -x; if(x < 10) putchar(x + 48); else print(x / 10), putchar(x % 10 + 48); } template <typename T> void print(T x, char t) { print(x); putchar(t); } template <typename T> struct hash_map_t { vector <T> v, val, nxt; vector <int> head; int mod, tot, lastv; T lastans; bool have_ans; hash_map_t (int md = 0) { head.clear(); v.clear(); val.clear(); nxt.clear(); tot = 0; mod = md; nxt.resize(1); v.resize(1); val.resize(1); head.resize(mod); have_ans = 0; } void clear() { *this = hash_map_t(mod); } bool count(int x) { int u = x % mod; for(register int i = head[u]; i; i = nxt[i]) { if(v[i] == x) { have_ans = 1; lastv = x; lastans = val[i]; return 1; } } return 0; } void ins(int x, int y) { int u = x % mod; nxt.push_back(head[u]); head[u] = ++tot; v.push_back(x); val.push_back(y); } int qry(int x) { if(have_ans && lastv == x) return lastans; count(x); return lastans; } }; int n, ans; inline int calc(int x) { int res = 0; while(x) { ++res; x /= 10; } return res; } int main() { read(n); for(register int i = 1; i <= n; i++) { if(calc(i) & 1) ++ans; } print(ans, '\n'); return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Uneven Numbers |
User | LJC00118 |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 2194 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | a01, a02, a03 |
All | a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
a01 | AC | 1 ms | 256 KB |
a02 | AC | 1 ms | 256 KB |
a03 | AC | 2 ms | 256 KB |
b04 | AC | 1 ms | 256 KB |
b05 | AC | 1 ms | 256 KB |
b06 | AC | 1 ms | 256 KB |
b07 | AC | 1 ms | 256 KB |
b08 | AC | 1 ms | 256 KB |
b09 | AC | 1 ms | 256 KB |
b10 | AC | 1 ms | 256 KB |
b11 | AC | 1 ms | 256 KB |
b12 | AC | 2 ms | 256 KB |
b13 | AC | 2 ms | 256 KB |